logback-spring.xml 1.5 KB
Newer Older
Q
qinyingjie 已提交
1
<?xml version="1.0" encoding="UTF-8"?>
2 3 4 5 6 7
<configuration>
    <property name="log.charset" value="utf-8"/>
    <property name="console.log.pattern"
              value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %blue(%msg%n)"/>
    <property name="file.log.pattern"
              value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/>
Q
qinyingjie 已提交
8

9
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
Q
qinyingjie 已提交
10
        <encoder>
11 12
            <pattern>${console.log.pattern}</pattern>
            <charset>${log.charset}</charset>
Q
qinyingjie 已提交
13 14 15
        </encoder>
    </appender>

16 17 18 19 20 21 22
    <appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>logs/SpringBoot-kwan.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>
                logs/SpringBoot-kwan-%d{yyyy-MM-dd}.%i.log
            </fileNamePattern>
            <maxFileSize>128MB</maxFileSize>
Q
qinyingjie 已提交
23
            <maxHistory>30</maxHistory>
24
            <totalSizeCap>20GB</totalSizeCap>
Q
qinyingjie 已提交
25
        </rollingPolicy>
26 27 28 29
        <encoder>
            <pattern>${file.log.pattern}</pattern>
            <charset>${log.charset}</charset>
        </encoder>
Q
qinyingjie 已提交
30 31
    </appender>

32 33 34
    <logger name="com.kwan.springbootkwan.mapper" level="info" additivity="false">
        <appender-ref ref="STDOUT"/>
    </logger>
Q
qinyingjie 已提交
35

36 37 38
    <root level="info">
        <appender-ref ref="STDOUT"/>
        <appender-ref ref="ROLLING"/>
Q
qinyingjie 已提交
39 40
    </root>
</configuration>