logback.xml文件配置标准输出和每日滚动文件追加器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了logback.xml文件配置标准输出和每日滚动文件追加器相关的知识,希望对你有一定的参考价值。
ch.qos.logbacklogback-classic
0.9.8
<?xml version="1.0" encoding="UTF-8" ?> <configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern> </layout> </appender> <!--Basic file appender<appender name="FILE" class="ch.qos.logback.core.FileAppender"> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern> </layout> <File>sample-log.txt</File> </appender>--> <!--Daily rolling file appender --> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <File>logFile.log</File> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>logFile.%d{yyyy-MM-dd}.log</FileNamePattern> </rollingPolicy> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern> </layout> </appender> <logger name="deng.mysimpleapp"> <level value="debug" /> </logger> <root> <level value="error" /> <appender-ref ref="STDOUT" /> <appender-ref ref="FILE" /> </root> </configuration>
以上是关于logback.xml文件配置标准输出和每日滚动文件追加器的主要内容,如果未能解决你的问题,请参考以下文章