Skip to content

Commit 37e8f4e

Browse files
committed
fix: logback-spring.xml의 loki appender 수정
- test profile에서는 loki가 동작하지 않도록 수정
1 parent 8b2d645 commit 37e8f4e

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

src/main/resources/logback-spring.xml

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,41 +28,43 @@
2828
</appender>
2929

3030
<!-- Loki Appender -->
31-
<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
31+
<springProfile name="!test">
32+
<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
3233

33-
<http>
34-
<url>${LOKI_URL}</url>
35-
<connectionTimeoutMs>30000</connectionTimeoutMs>
36-
<requestTimeoutMs>15000</requestTimeoutMs>
37-
<maxRetries>3</maxRetries>
38-
<backoffMs>1000</backoffMs>
39-
</http>
34+
<http>
35+
<url>${LOKI_URL}</url>
36+
<connectionTimeoutMs>30000</connectionTimeoutMs>
37+
<requestTimeoutMs>15000</requestTimeoutMs>
38+
<maxRetries>3</maxRetries>
39+
<backoffMs>1000</backoffMs>
40+
</http>
4041

41-
<batchSize>100</batchSize>
42-
<batchTimeoutMs>10000</batchTimeoutMs>
43-
<bufferSize>1048576</bufferSize>
42+
<batchSize>100</batchSize>
43+
<batchTimeoutMs>10000</batchTimeoutMs>
44+
<bufferSize>1048576</bufferSize>
4445

45-
<format>
46-
<label>
47-
<pattern>app=my-app,host=${HOSTNAME},environment=${ENV:-local},service=${SERVICE_NAME:-somemore}</pattern>
48-
</label>
49-
<message class="com.github.loki4j.logback.JsonLayout">
50-
<includeTimestamp>true</includeTimestamp>
51-
<includeMDC>true</includeMDC>
52-
<includeThreadName>true</includeThreadName>
53-
<includeLoggerName>true</includeLoggerName>
54-
<jsonFactory>JACKSON</jsonFactory>
55-
<timestampFieldName>@timestamp</timestampFieldName>
56-
<prettyPrint>false</prettyPrint>
57-
<appendLineSeparator>true</appendLineSeparator>
58-
<messageTemplate>${LOG_PATTERN}</messageTemplate>
59-
<timestampFormat>yyyy-MM-dd HH:mm:ss.SSS</timestampFormat>
60-
</message>
61-
<timestampPattern>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampPattern>
62-
</format>
46+
<format>
47+
<label>
48+
<pattern>app=my-app,host=${HOSTNAME},environment=${ENV:-local},service=${SERVICE_NAME:-somemore}</pattern>
49+
</label>
50+
<message class="com.github.loki4j.logback.JsonLayout">
51+
<includeTimestamp>true</includeTimestamp>
52+
<includeMDC>true</includeMDC>
53+
<includeThreadName>true</includeThreadName>
54+
<includeLoggerName>true</includeLoggerName>
55+
<jsonFactory>JACKSON</jsonFactory>
56+
<timestampFieldName>@timestamp</timestampFieldName>
57+
<prettyPrint>false</prettyPrint>
58+
<appendLineSeparator>true</appendLineSeparator>
59+
<messageTemplate>${LOG_PATTERN}</messageTemplate>
60+
<timestampFormat>yyyy-MM-dd HH:mm:ss.SSS</timestampFormat>
61+
</message>
62+
<timestampPattern>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampPattern>
63+
</format>
6364

64-
<timeZone>Asia/Seoul</timeZone>
65-
</appender>
65+
<timeZone>Asia/Seoul</timeZone>
66+
</appender>
67+
</springProfile>
6668

6769
<logger name="com.somemore.application" level="DEBUG" additivity="false">
6870
<appender-ref ref="CONSOLE" />

0 commit comments

Comments
 (0)