forked from junneyang/xxproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logback-base.xml
149 lines (139 loc) · 6.54 KB
/
logback-base.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!-- Logback configuration. See https://logback.qos.ch/manual/index.html -->
<included>
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<springProperty scope="context" name="springAppName" source="spring.application.name"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder
by default -->
<encoder>
<!-- %clr([%mdc{requestID:-00000000-0000-0000-0000-000000000000}]) 0000000000000000 -->
<pattern>%clr([${springAppName:-}:%X{X-B3-TraceId:-0000000000000000}:%X{X-B3-SpanId:-0000000000000000}:%X{X-Span-Export:-false}]){yellow} %clr(%d{yyyy-MM-dd-HH:mm:ss.SSS}){faint} %clr([%-5p]) %clr(${PID:-}){magenta} %clr([%-15.15t]){faint} %clr(---){faint} %clr([%-40.40logger{39}]){cyan} %clr([%4.4line]){blue} %clr(:){faint} %m%n%wex
</pattern>
</encoder>
</appender>
<appender name="ROLLING_FILE_ALL"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${LOG_PATH}/app.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/app-%d{yyyyMMdd}.log.%i
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>30</maxHistory>
<totalSizeCap>30GB</totalSizeCap>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%clr([${springAppName:-}:%X{X-B3-TraceId:-0000000000000000}:%X{X-B3-SpanId:-0000000000000000}:%X{X-Span-Export:-false}]){yellow} %clr(%d{yyyy-MM-dd-HH:mm:ss.SSS}){faint} %clr([%-5p]) %clr(${PID:-}){magenta} %clr([%-15.15t]){faint} %clr(---){faint} %clr([%-40.40logger{39}]){cyan} %clr([%4.4line]){blue} %clr(:){faint} %m%n%wex
</pattern>
</layout>
</appender>
<appender name="ROLLING_FILE_INFO"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<File>${LOG_PATH}/app.INFO.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/app.INFO-%d{yyyyMMdd}.log.%i
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>30</maxHistory>
<totalSizeCap>30GB</totalSizeCap>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%clr([${springAppName:-}:%X{X-B3-TraceId:-0000000000000000}:%X{X-B3-SpanId:-0000000000000000}:%X{X-Span-Export:-false}]){yellow} %clr(%d{yyyy-MM-dd-HH:mm:ss.SSS}){faint} %clr([%-5p]) %clr(${PID:-}){magenta} %clr([%-15.15t]){faint} %clr(---){faint} %clr([%-40.40logger{39}]){cyan} %clr([%4.4line]){blue} %clr(:){faint} %m%n%wex
</pattern>
</layout>
</appender>
<appender name="ROLLING_FILE_ERROR"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<File>${LOG_PATH}/app.ERROR.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/app.ERROR-%d{yyyyMMdd}.log.%i
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>30</maxHistory>
<totalSizeCap>30GB</totalSizeCap>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%clr([${springAppName:-}:%X{X-B3-TraceId:-0000000000000000}:%X{X-B3-SpanId:-0000000000000000}:%X{X-Span-Export:-false}]){yellow} %clr(%d{yyyy-MM-dd-HH:mm:ss.SSS}){faint} %clr([%-5p]) %clr(${PID:-}){magenta} %clr([%-15.15t]){faint} %clr(---){faint} %clr([%-40.40logger{39}]){cyan} %clr([%4.4line]){blue} %clr(:){faint} %m%n%wex
</pattern>
</layout>
</appender>
<appender name="LOGSTASH_TCP" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<!-- <appender name="LOGSTASH_TCP" class="net.logstash.logback.appender.LogstashAccessTcpSocketAppender"> -->
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter> -->
<if condition='property("SPRING_PROFILES_ACTIVE").contains("docker")'>
<then>
<destination>${LOGSTASH_SERVER}:${LOGSTASH_TCP_SERVER_PORT}</destination>
</then>
<else>
<destination>${LOGSTASH_SERVER_HOST}:${LOGSTASH_TCP_SERVER_PORT}</destination>
</else>
</if>
<keepAliveDuration>5 minutes</keepAliveDuration>
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<!-- <encoder class="net.logstash.logback.encoder.AccessEventCompositeJsonEncoder"> -->
<providers>
<!-- <mdc/> -->
<!-- <method/>
<protocol/>
<statusCode/>
<requestedUrl/>
<requestedUri/>
<remoteHost/>
<remoteUser/>
<contentLength/>
<elapsedTime/>
<requestHeaders/>
<responseHeaders/> -->
<pattern>
<pattern>
{
"appName": "${springAppName:-}",
"traceId": "%X{X-B3-TraceId:-0000000000000000}",
"spanId": "%X{X-B3-SpanId:-0000000000000000}",
"export": "%X{X-Span-Export:-false}",
"timeStamp": "%d{yyyy-MM-dd-HH:mm:ss.SSS}",
"level": "%p",
"pid": "${PID:-}",
"thread": "%t",
"logger": "%logger",
"line": "#asLong{%line}",
"message": "%m%n%wex"
}
</pattern>
</pattern>
</providers>
</encoder>
</appender>
<!-- <logger name="springframework.web" level="INFO" />
<logger name="org.springframework.security" level="INFO" />
<logger name="org.springframework.session" level="INFO" />
<logger name="org.hibernate.SQL" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="TRACE" />
<logger name="org.hibernate.type" level="TRACE" />
<logger name="org.hibernate.engine.QueryParameters" level="TRACE" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="TRACE" /> -->
<root level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
<appender-ref ref="ROLLING_FILE_ALL" />
<appender-ref ref="ROLLING_FILE_INFO" />
<appender-ref ref="ROLLING_FILE_ERROR" />
<appender-ref ref="LOGSTASH_TCP" />
</root>
</included>