ail.1.1.1.source-code.logback.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <configuration scan="false" scanPeriod="60 seconds" debug="false"> <property name="system.name" value="Snail" /> <property name="system.charset" value="utf-8" /> <property name="system.pattern" value="[${system.name}] %d{YYYY-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" /> <contextName>${system.name}</contextName> <!-- 文件日志 --> <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>logs/${system.name}.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <maxHistory>30</maxHistory> <fileNamePattern>logs/${system.name}.log-%d{yyyy-MM-dd}</fileNamePattern> </rollingPolicy> <!-- 推荐:使用encoder替换layout,否者系统会在启动时有一个警告日志。 <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>${system.pattern}</pattern> </layout> --> <!-- 缓存大小:8KB --> <bufferSize>8192</bufferSize> <!-- 不立即刷新,缓存默认:8KB(系统关闭时请关闭日志框架,防止日志不能flush导致丢失) --> <immediateFlush>false</immediateFlush> <encoder> <charset>${system.charset}</charset> <pattern>${system.pattern}</pattern> </encoder> </appender> <!-- 控制台日志 --> <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>DEBUG</level> </filter> --> <encoder> <charset>${system.charset}</charset> <pattern>${system.pattern}</pattern> </encoder> </appender> <root level="DEBUG"> <appender-ref ref="file" /> <appender-ref ref="console" /> </root> </configuration>