logback.xml
编程技术  /  houtizong 发布于 3年前   118
<?xml version="1.0" encoding="UTF-8"?><configuration scan="true" scanPeriod="60 seconds" debug="false"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <!--<file>${catalina.home}\logs\tomcat.log</file> --> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern> <charset>UTF-8</charset> </layout> </appender> <appender name="InfoRollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>INFO</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <!-- 可让每天产生一个日志文件,最多 10 个,自动回滚 --> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${catalina.home}\logs\baby-manager\info-%d{yyyy-MM-dd}.log</fileNamePattern> <maxHistory>10</maxHistory> </rollingPolicy> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="ErrorRollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${catalina.home}\logs\baby-manager\error-%d{yyyy-MM-dd}.log</fileNamePattern> <maxHistory>10</maxHistory> </rollingPolicy> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="DebugRollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>DEBUG</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${catalina.home}\logs\baby-manager\debug-%d{yyyy-MM-dd}.log</fileNamePattern> <maxHistory>10</maxHistory> </rollingPolicy> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="WarnRollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>WARN</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${catalina.home}\logs\baby-manager\warn-%d{yyyy-MM-dd}.log</fileNamePattern> <maxHistory>10</maxHistory> </rollingPolicy> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <logger name="org.springframework" level="DEBUG"></logger> <logger name="mysql" level="ERROR"></logger> <logger name="org.mybatis" level="DEBUG"></logger> <root level="DEBUG"> <appender-ref ref="STDOUT" /> <appender-ref ref="InfoRollingFile"/> <appender-ref ref="ErrorRollingFile"/> <appender-ref ref="DebugRollingFile"/> <appender-ref ref="WarnRollingFile"/> <!--<appender-ref ref="TomcatFile"/> --> </root></configuration>
这个是我的logback.xml。
当后台不输出错误的时候,并不是没有错误。而是因为某些原因不输出而已,所以,要么配置log4j,要么配置logback。
版权声明:本文为博主原创文章,未经博主允许不得转载。
请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!
技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成
网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];
文章归档
文章标签
友情链接