码迷,mamicode.com
首页 > 其他好文 > 详细

logback.xml配置

时间:2017-11-07 22:08:29      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:span   config   coder   soft   add   ons   scan   window   encoding   

技术分享
 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <configuration scan="true" scanPeriod="60 seconds" debug="false">
 3     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
 4         <encoding>UTF-8</encoding>
 5         <encoder>
 6             <pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
 7         </encoder>
 8         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
 9             <level>DEBUG</level>
10         </filter>
11     </appender>
12 
13     <appender name="mall" class="ch.qos.logback.core.rolling.RollingFileAppender">
14         <File>E:\software_setup\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\logs\mall.log</File>
15         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
16             <fileNamePattern>E:\software_setup\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\logs\mall.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
17             <append>true</append>
18             <maxHistory>10</maxHistory>
19         </rollingPolicy>
20         <encoder>
21             <pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
22         </encoder>
23     </appender>
24 
25 
26     <appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
27         <File>E:\software_setup\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\logs\error.log</File>
28         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
29             <fileNamePattern>E:\software_setup\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\logs\error.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
30             <append>true</append>
31             <maxHistory>10</maxHistory>
32         </rollingPolicy>
33         <encoder>
34             <pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
35         </encoder>
36         <filter class="ch.qos.logback.classic.filter.LevelFilter">
37             <level>ERROR</level>
38             <onMatch>ACCEPT</onMatch>
39             <onMismatch>DENY</onMismatch>
40         </filter>
41     </appender>
42 
43     <logger name="com.mall" additivity="false" level="INFO" >
44         <appender-ref ref="mall" />
45         <appender-ref ref="console"/>
46     </logger>
47 
48 
49 
50     <!-- geelynote mybatis log 日志 -->
51 
52     <logger name="com.mall.dao" level="DEBUG"/>
53 
54     <root level="DEBUG">
55         <appender-ref ref="console"/>
56         <appender-ref ref="error"/>
57     </root>
58 
59 </configuration>
View Code

ps:将dao层的debug打开,使其可以打印sql语句以排错。

logback.xml配置

标签:span   config   coder   soft   add   ons   scan   window   encoding   

原文地址:http://www.cnblogs.com/cing/p/7800955.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!