Skip to content

Commit

Permalink
[BE] feat: warn, error 발생 시 슬랙으로 알람기능 추가 (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
wugawuga authored Aug 7, 2023
1 parent d449a76 commit 7473c96
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies {
implementation 'org.springdoc:springdoc-openapi-ui:1.7.0'
implementation 'commons-fileupload:commons-fileupload:1.5'
implementation 'commons-io:commons-io:2.11.0'
implementation 'com.github.maricn:logback-slack-appender:1.4.0'
}

tasks.named('test') {
Expand Down
28 changes: 28 additions & 0 deletions backend/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>

<springProperty name="SLACK_WEBHOOK_URI" source="logging.slack.webhook-uri"/>
<appender name="SLACK" class="com.github.maricn.logback.SlackAppender">
<webhookUri>${SLACK_WEBHOOK_URI}</webhookUri>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>[%d{yyyy-MM-dd HH:mm:ss}:%-3relative][%thread] %-5level %logger{0} - %msg%n</Pattern>
</layout>
<username>open-macbook</username>
<iconEmoji>:face_with_symbols_on_mouth:</iconEmoji>
<colorCoding>true</colorCoding>
</appender>

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

<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="ASYNC_SLACK"/>
</root>
</configuration>

0 comments on commit 7473c96

Please sign in to comment.