generated from arafkarsh/ms-springboot-324-java-22-jakarta-ee-10
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathlogback-spring-appenders-json.xml
executable file
·48 lines (46 loc) · 1.6 KB
/
logback-spring-appenders-json.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<included>
<!-- Define the Standard Output - Console JSON -->
<appender name="STDOUT_JSON" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<timestamp/>
<loggerName/>
<logLevel/>
<message/>
<threadName/>
<mdc/>
</providers>
</encoder>
</appender>
<!-- JSON File Appender -->
<appender name="FILE_JSON" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${LOG_FILE}.json</file>
<!-- <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- Combines size-based rolling and time-based rolling -->
<fileNamePattern>${LOG_FILE_PATTERN}.json</fileNamePattern>
<!-- Specify max size of a single log file -->
<maxFileSize>${LOG_FILE_MAX_SIZE}</maxFileSize>
<!-- Retain log history for a specific number of days -->
<maxHistory>${LOG_FILE_MAX_HISTORY}</maxHistory>
<!-- Specify file size Cap -->
<totalSizeCap>${LOG_FILE_SIZE_CAP}</totalSizeCap>
</rollingPolicy>
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<timestamp/>
<loggerName/>
<logLevel/>
<message/>
<threadName/>
<mdc/>
</providers>
</encoder>
</appender>
<!-- Asynchronous Logging JSON Text -->
<appender name="ASYNC_JSON" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="FILE_JSON" />
<queueSize>3000</queueSize>
<discardingThreshold>0</discardingThreshold>
</appender>
</included>