Skip to content

Commit

Permalink
setting: 개발 서버 에러를 슬랙으로 알림 전송 (#30)
Browse files Browse the repository at this point in the history
* remove: application-api.yml 제거 및 .gitignore 수정

* chore: slack appender 의존성 추가

* feat: logback.xml 추가

* chore: .gitignore 범위 수정
  • Loading branch information
leeeeeyeon authored Jan 15, 2024
1 parent 2eb82a2 commit 484a12f
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ out/
.vscode/

### application.yml ###
/packy-api/src/main/resources/
/packy-domain/src/main/resources/
packy-api/src/main/resources/*.yml
packy-api/src/main/resources/*.p8
packy-domain/src/main/resources/*.yml
3 changes: 3 additions & 0 deletions packy-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ dependencies {

// swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'

// logback
implementation 'com.github.maricn:logback-slack-appender:1.6.1'
}

test {
Expand Down
2 changes: 0 additions & 2 deletions packy-api/src/main/resources/application-api.yml

This file was deleted.

42 changes: 42 additions & 0 deletions packy-api/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>

<springProfile name="local">
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>

<springProfile name="dev">
<property resource="application-api.yml"/>
<springProperty name="SLACK_WEBHOOK_URL" source="logging.slack.webhook-url.dev"/>
<appender name="SLACK" class="com.github.maricn.logback.SlackAppender">
<webhookUri>${SLACK_WEBHOOK_URL}</webhookUri>
<channel>패키-서버-에러-dev</channel>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%date %-5level - %msg%n</pattern>
</layout>
<colorCoding>true</colorCoding>
</appender>

<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<charset>utf8</charset>
</encoder>
</appender>

<appender name="ASYNC_SLACK" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="SLACK"/>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>

<root level="INFO">
<appender-ref ref="Console"/>
<appender-ref ref="ASYNC_SLACK"/>
</root>
</springProfile>
</configuration>
6 changes: 6 additions & 0 deletions packy-domain/src/main/resources/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
insert into profile_image (img_url)
values ('https://i.namu.wiki/i/ColQt99Ihs3__vEx5_WU-suvLoublbI759tqUZXkR5S0Mw7mdPUetnOC5apdIiA3W-6_1pHgHGt_jW0vawnoprvckgMI4BnZW_M6knOfsmE4EY-Wh3fB9Sqvw1cZcOepAs2H66LIT71GAVhX084JIg.webp'),
('https://i.namu.wiki/i/VM0HKbO6P_3h9UAkcpkdrAuh5u9u4do8Zk_jzH2ogoR3tPZzDJMPjaPJFfQhfljQs79HulYqbnyxhhcsuFMtclynGmVWv4cWdWBHmRoN3i65ATyUmma-g63f5csVFc0JMqeIUisGaD_f6D83kMvBbg.webp'),
('https://i.namu.wiki/i/T-5Ct-xiiSTe9IziaMTWTHG9Y4s6HyFmvgMpBirXQ4iXI2J2V-vpeKbZTbNdEy9nXDObh4yxmDxWnsEDjThQ0s0N2ugFCBi0yPpsNPdaotA_snhfODPyhgYswKlpIAIUR3sS9c92LeKk-L4CGwzTjA.webp'),
('https://i.namu.wiki/i/b4FeNnpcwDt7ySrOmx-JNbcNzfTaPD4bFTy4drseaA5t0-gzSuoBrqSHM_cA56yGUOUSBvATYYQkQpMJ-Gs6zKqv0BzajruwccEDhy1Gpt5JjWBB3EP7Rhnofxpd6nnRXDq4mi3iiLQEHe2uhZUO6Q.webp');

2 changes: 1 addition & 1 deletion packy-submodule

0 comments on commit 484a12f

Please sign in to comment.