33 lines
1.4 KiB
XML
33 lines
1.4 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
||
<configuration>
|
||
<!--包含Spring boot对logback日志的默认配置-->
|
||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||
<property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}"/>
|
||
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
|
||
|
||
<!--重写了Spring Boot框架 org/springframework/boot/logging/logback/file-appender.xml 配置-->
|
||
<appender name="TIME_FILE"
|
||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||
<encoder>
|
||
<pattern>${FILE_LOG_PATTERN}</pattern>
|
||
</encoder>
|
||
<file>${LOG_FILE}</file>
|
||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||
<!--
|
||
Spring Boot默认情况下,日志文件10M时,会切分日志文件,这样设置日志文件会在100M时切分日志
|
||
-->
|
||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||
<maxFileSize>10MB</maxFileSize>
|
||
</timeBasedFileNamingAndTriggeringPolicy>
|
||
|
||
</rollingPolicy>
|
||
</appender>
|
||
|
||
<root level="INFO">
|
||
<appender-ref ref="CONSOLE" />
|
||
<appender-ref ref="TIME_FILE" />
|
||
</root>
|
||
|
||
</configuration>
|