123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?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"/>
- <!-- 彩色日志格式 -->
- <property name="CONSOLE_LOG_PATTERN"
- value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n" />
- <!-- Console log output -->
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <pattern>${CONSOLE_LOG_PATTERN}</pattern>
- </encoder>
- </appender>
- <appender name="FILE"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <!-- rollingPolicy:当发生滚动时,决定 RollingFileAppender 的行为,涉及文件移动和重命名。 -->
- <!-- TimeBasedRollingPolicy: 最常用的滚动策略,它根据时间来制定滚动策略,既负责滚动也负责出发滚动 -->
- <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
- <!-- 活动文件的名字会根据fileNamePattern的值,每隔一段时间改变一次 -->
- <!-- 文件名:log/sys.2017-12-05.0.log -->
- <fileNamePattern>${log.path}/logs/system.log.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
- <!-- 每产生一个日志文件,该日志文件的保存期限为30天 -->
- <maxHistory>30</maxHistory>
- <maxFileSize>1000MB</maxFileSize>
- </rollingPolicy>
- <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>1KB</maxFileSize>
- </triggeringPolicy>-->
- </appender>
- <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
- <root level="INFO">
- <appender-ref ref="console" />
- <appender-ref ref="FILE"/>
- </root>
- <logger name="com.jkcredit.invoice" level="INFO">
- <appender-ref ref="FILE"/>
- </logger>
- </configuration>
|