Skip to content

Commit

Permalink
[FEATURE] Logback 모니터링 설정 (#134)
Browse files Browse the repository at this point in the history
* chore: Loki 의존성 추가 (#133)

* feat: Logback 설정 (#133)

* test: Logback 모니터링 설정 (#133)

* feat: loki url 변경 (#133)

* feat: Logback 모니터링 설정 (#133)
  • Loading branch information
hyunmin0317 authored Dec 28, 2024
1 parent f9d9b95 commit 41ec2e5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ dependencies {
// Prometheus
implementation 'io.micrometer:micrometer-registry-prometheus'

// Loki
implementation 'com.github.loki4j:loki-logback-appender:1.5.2'

// JSON Web Token
implementation 'io.jsonwebtoken:jjwt-api:0.12.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.5'
Expand Down
41 changes: 41 additions & 0 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>

<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
<http>
<url>http://3.37.189.47:3100/loki/api/v1/push</url>
</http>
<format>
<label>
<pattern>app=smunity,level=%level,host=${HOSTNAME}</pattern>
</label>
<message class="com.github.loki4j.logback.JsonLayout"/>
</format>
</appender>

<springProfile name="local">
<root level="DEBUG">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>

<springProfile name="dev">
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>

<springProfile name="release">
<root level="WARN">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="LOKI"/>
</root>
</springProfile>
</configuration>

0 comments on commit 41ec2e5

Please sign in to comment.