<?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="60 seconds" debug="false"> <property name="LOG_HOME" value="./logs"/> <property name="ENCODER_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS}[%thread] %-5level %logger{80} - %msg%n"/> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>${ENCODER_PATTERN}</pattern> </layout> </appender> <!-- 系统INFO日志 --> <appender name="INFO_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${LOG_HOME}/info.log</file> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>INFO</level><!-- 打印INFO及以上级别(INFO,WARN,ERROR) --> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${LOG_HOME}/history/info-%d{yyyyMMdd}.log</fileNamePattern> <maxHistory>7</maxHistory> </rollingPolicy> <encoder charset="UTF-8"> <pattern>${ENCODER_PATTERN}</pattern> </encoder> </appender> <!-- 系统ERROR日志 --> <appender name="ERROR_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${LOG_HOME}/error.log</file> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>ERROR</level><!-- 打印ERROR及以上级别(ERROR) --> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${LOG_HOME}/history/error-%d{yyyyMMdd}.log</fileNamePattern> <maxHistory>7</maxHistory> </rollingPolicy> <encoder charset="UTF-8"> <pattern>${ENCODER_PATTERN}</pattern> </encoder> </appender> <root level="INFO"> <appender-ref ref="STDOUT"/> <appender-ref ref="INFO_LOG"/> <appender-ref ref="ERROR_LOG"/> </root> </configuration>