Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
李飞
committed
Dec 4, 2019
1 parent
c11a453
commit c3e4a9b
Showing
15 changed files
with
147 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/> | ||
| ||
<springProperty scope="context" name="springAppName" source="spring.application.name"/> | ||
|
||
<!-- Example for logging into the build folder of your project --> | ||
<property name="LOG_FILE" value="./logs/lightbatis/${springAppName}/${springAppName}"/> | ||
<!-- 彩色日志 --> | ||
<!-- 彩色日志依赖的渲染类 --> | ||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> | ||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> | ||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> | ||
<!-- 彩色日志格式 --> | ||
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> | ||
|
||
<!-- <property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr([${springAppName:-},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-B3-ParentSpanId:-},%X{X-Span-Export:-}]){yellow} %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>--> | ||
|
||
<!-- Appender to log to console --> | ||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | ||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
<!-- Minimum logging level to be presented in the console logs --> | ||
<level>INFO</level> | ||
<level>DEBUG</level> | ||
</filter> | ||
<encoder> | ||
<pattern>${CONSOLE_LOG_PATTERN}</pattern> | ||
<charset>utf8</charset> | ||
</encoder> | ||
</appender> | ||
|
||
<!-- Appender to log to file --> | ||
<appender name="flatfile" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${LOG_FILE}</file> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.gz</fileNamePattern> | ||
<maxHistory>7</maxHistory> | ||
</rollingPolicy> | ||
<encoder> | ||
<pattern>${CONSOLE_LOG_PATTERN}</pattern> | ||
<charset>utf8</charset> | ||
</encoder> | ||
</appender> | ||
| ||
<!-- Appender to log to file in a JSON format --> | ||
<appender name="logstash" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<file>${LOG_FILE}.json</file> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOG_FILE}.json.%d{yyyy-MM-dd}.gz</fileNamePattern> | ||
<maxHistory>7</maxHistory> | ||
</rollingPolicy> | ||
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder"> | ||
<providers> | ||
<timestamp> | ||
<timeZone>UTC</timeZone> | ||
</timestamp> | ||
<pattern> | ||
<pattern> | ||
{ | ||
"severity": "%level", | ||
"service": "${springAppName:-}", | ||
"trace": "%X{X-B3-TraceId:-}", | ||
"span": "%X{X-B3-SpanId:-}", | ||
"parent": "%X{X-B3-ParentSpanId:-}", | ||
"exportable": "%X{X-Span-Export:-}", | ||
"pid": "${PID:-}", | ||
"thread": "%thread", | ||
"class": "%logger{40}", | ||
"rest": "%message" | ||
} | ||
</pattern> | ||
</pattern> | ||
</providers> | ||
</encoder> | ||
</appender> | ||
|
||
<appender name="MyBatisStatistics" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<fileNamePattern>${LOG_FILE}.sql.%d{yyyy-MM-dd}.gz</fileNamePattern> | ||
<maxHistory>10</maxHistory> | ||
</rollingPolicy> | ||
<encoder> | ||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}-%msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!--encoder 默认配置为PatternLayoutEncoder--> | ||
<encoder> | ||
<pattern>===%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n</pattern> | ||
<charset>utf-8</charset> | ||
</encoder> | ||
|
||
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> | ||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
<level>debug</level> | ||
</filter> | ||
</appender> | ||
|
||
<logger name="org.springframework" level="INFO" /> | ||
<logger name="org.hibernate" level="WARN" /> | ||
<logger name="titan.lightbatis.mybatis" level="INFO"/> | ||
<logger name="titan.lightbatis.mybatis.provider.impl" level="INFO"/> | ||
|
||
<logger name="simple" level="DEBUG"> | ||
<appender-ref ref="console" /> | ||
</logger> | ||
<logger name="titan.lightbatis.mybatis" level="DEBUG"> | ||
<appender-ref ref="STDOUT" /> | ||
</logger> | ||
|
||
<root level="debug"> | ||
<!-- <appender-ref ref="console"/>--> | ||
<!-- <appender-ref ref="logstash"/>--> | ||
<!-- <appender-ref ref="flatfile"/>--> | ||
<!-- 生产环境将请stdout,testfile去掉 --> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> |