日志文件
<?xml version="1.0" encoding="UTF-8"?> <configuration scan="true"> <contextName>auth</contextName> <property name="LOG_APP_NAME" value="${LOG_APP_NAME:auth}"/> <property name="LOG_PATH" value="${log_root}${file.separator}${LOG_APP_NAME}"/> <!-- 输出到控制台 --> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level -[%F:%L]- %msg%n </pattern> </layout> </appender> <!-- 输出到文件 --> <appender name="fileLog" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${LOG_PATH}/${LOG_APP_NAME}.log</file> <append>true</append> <encoder> <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %t %logger{40} - %msg%n </pattern> </encoder> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <!-- rollover daily --> <fileNamePattern>${LOG_PATH}/${LOG_APP_NAME}.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <!-- each file should be at most 100MB, keep 7 days worth of history, but at most 2GB --> <!-- <maxFileSize>100MB</maxFileSize> --> <maxHistory>${FILE_MAX_HISTORY:-30}</maxHistory> <maxFileSize>${FILE_MAX_SIZE:-2GB}</maxFileSize> </rollingPolicy> </appender> <root level="INFO"> <appender-ref ref="fileLog"/> <appender-ref ref="stdout"/> </root> <logger name="com.itmy.dao" level="DEBUG"> <appender-ref ref="fileLog"/> </logger> </configuration>