<?xml version="1.0" encoding="UTF-8"?>标签:-%,log,LOG,APP,打印,HOME,日志,NAME From: https://www.cnblogs.com/yanlai/p/16853545.html
<configuration debug="false" scan="true" scanPeriod="10 seconds">
<property name="APP_NAME" value="clotho-risk-control"/>
<property name="LOG_HOME" value="../../logs"/>
<property name="ENCODER_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS}|||%X{remoteIp:--}|||%level|||%X{action:--}|||%X{requestId:--}|||%X{traceId:--}|||%X{sessionId:--}|||[%thread] - [%logger:%L] - %msg%n"/>
<contextName>${APP_NAME}</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>${ENCODER_PATTERN}</Pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_HOME}/${APP_NAME}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/${APP_NAME}.log-%d{yyyyMMddHH}-%i</fileNamePattern>
<maxHistory>72</maxHistory>
<maxFileSize>10GB</maxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${ENCODER_PATTERN}</pattern>
</encoder>
</appender>
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_HOME}/${APP_NAME}_error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/${APP_NAME}_error.log-%d{yyyyMMddHH}-%i</fileNamePattern>
<maxHistory>72</maxHistory>
<maxFileSize>10GB</maxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${ENCODER_PATTERN}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<logger name="error" level="ERROR" additivity="false">
<appender-ref ref="ERROR_FILE"/>
</logger>
<root>
<level value="INFO"/>
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root>
</configuration>