|
@@ -1,10 +1,10 @@
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<configuration debug="false" scan="false">
|
|
|
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
|
|
- <property name="log.path" value="/home/app/logs"/>
|
|
|
+ <property name="log.path" value="/home/app"/>
|
|
|
<!-- 彩色日志格式 -->
|
|
|
<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}}" />
|
|
|
+ value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n" />
|
|
|
<!-- 彩色日志依赖的渲染类 -->
|
|
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
|
|
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
|
|
@@ -12,47 +12,41 @@
|
|
|
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
|
|
|
<!-- Console log output -->
|
|
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
|
- <encoder>
|
|
|
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
|
|
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
|
</encoder>
|
|
|
</appender>
|
|
|
|
|
|
- <appender name="syslog"
|
|
|
+
|
|
|
+ <appender name="FILE"
|
|
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
|
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
|
- <level>TRACE</level>
|
|
|
- </filter>
|
|
|
+
|
|
|
<!-- rollingPolicy:当发生滚动时,决定 RollingFileAppender 的行为,涉及文件移动和重命名。 -->
|
|
|
<!-- TimeBasedRollingPolicy: 最常用的滚动策略,它根据时间来制定滚动策略,既负责滚动也负责出发滚动 -->
|
|
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
|
<!-- 活动文件的名字会根据fileNamePattern的值,每隔一段时间改变一次 -->
|
|
|
<!-- 文件名:log/sys.2017-12-05.0.log -->
|
|
|
- <fileNamePattern>${log.path}/log/sys.%d.%i.log</fileNamePattern>
|
|
|
+ <fileNamePattern>${log.path}/log/system.log.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
|
<!-- 每产生一个日志文件,该日志文件的保存期限为30天 -->
|
|
|
- <maxHistory>30</maxHistory>
|
|
|
- <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
|
- <!-- maxFileSize:这是活动文件的大小,默认值是10MB,本篇设置为1KB,只是为了演示 -->
|
|
|
- <maxFileSize>10M</maxFileSize>
|
|
|
- </timeBasedFileNamingAndTriggeringPolicy>
|
|
|
+ <maxHistory>60</maxHistory>
|
|
|
</rollingPolicy>
|
|
|
- <encoder>
|
|
|
- <!-- pattern节点,用来设置日志的输入格式 -->
|
|
|
- <pattern>
|
|
|
- %d %p (%file:%line\)- %m%n
|
|
|
- </pattern>
|
|
|
- <!-- 记录日志的编码 -->
|
|
|
- <charset>UTF-8</charset> <!-- 此处设置字符集 -->
|
|
|
- </encoder>
|
|
|
- </appender>
|
|
|
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
|
|
+ <pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
|
+ </encoder>
|
|
|
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
|
|
+ <!-- maxFileSize:这是活动文件的大小,默认值是10MB,本篇设置为1KB,只是为了演示 -->
|
|
|
+ <maxFileSize>50M</maxFileSize>
|
|
|
+ </triggeringPolicy>
|
|
|
|
|
|
+ </appender>
|
|
|
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
|
<root level="INFO">
|
|
|
<appender-ref ref="console" />
|
|
|
- <appender-ref ref="syslog" />
|
|
|
+ <appender-ref ref="FILE"/>
|
|
|
</root>
|
|
|
|
|
|
|
|
|
- <logger name="com.jkcredit.invoice" level="INFO">
|
|
|
- <appender-ref ref="syslog"/>
|
|
|
+ <logger name="com.jkcredit.invoice" level="INFO">
|
|
|
+ <appender-ref ref="FILE"/>
|
|
|
</logger>
|
|
|
</configuration>
|