logj4.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <!DOCTYPE log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.dtd">
 3 <log4j:configuration>
 4     <!--输出到控制台-->
 5     <appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
 6         <param name="Threshold" value="DEBUG"/>
 7         <layout class="org.apache.log4j.PatternLayout">
 8             <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
 9         </layout>
10     </appender>
11 
12     <!--输出到文件(info)-->
13     <!--将生成“info.log.2014-06-11”这样的日志文件-->
14     <appender name="fileAppenderInfo" class="org.apache.log4j.DailyRollingFileAppender">
15         <param name="File" value="${user.home}/logs/website/info.log" />
16         <param name="DatePattern" value=".yyyy-MM-dd" />
17         <layout class="org.apache.log4j.PatternLayout">
18             <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
19         </layout>
20         <filter class="org.apache.log4j.varia.LevelRangeFilter">
21             <param name="LevelMin" value="INFO" />
22             <param name="LevelMax" value="INFO" />
23         </filter>
24     </appender>
25 
26     <!--输出到文件(warn)-->
27     <appender name="fileAppenderWarn" class="org.apache.log4j.DailyRollingFileAppender">
28         <param name="File" value="${user.home}/logs/website/warn.log" />
29         <param name="DatePattern" value=".yyyy-MM-dd" />
30         <layout class="org.apache.log4j.PatternLayout">
31             <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
32         </layout>
33 
34         <filter class="org.apache.log4j.varia.LevelRangeFilter">
35             <param name="LevelMin" value="WARN" />
36             <param name="LevelMax" value="WARN" />
37         </filter>
38     </appender>
39 
40     <!--输出到文件(error)-->
41     <appender name="fileAppenderError" class="org.apache.log4j.DailyRollingFileAppender">
42         <param name="File" value="${user.home}/logs/website/error.log" />
43         <param name="DatePattern" value=".yyyy-MM-dd" />
44         <layout class="org.apache.log4j.PatternLayout">
45             <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
46         </layout>
47         <filter class="org.apache.log4j.varia.LevelRangeFilter">
48             <param name="LevelMin" value="ERROR" />
49             <param name="LevelMax" value="ERROR" />
50         </filter>
51     </appender>
52 
53     <!--屏蔽所有org.springframework.*输出的Debug(及以下)信息-->
54     <logger name="org.springframework">
55         <level value="INFO"></level>
56     </logger>
57 
58     <root>
59         <level value="ALL"/>
60         <appender-ref ref="consoleAppender" />
61         <appender-ref ref="fileAppenderInfo" />
62         <appender-ref ref="fileAppenderWarn" />
63         <appender-ref ref="fileAppenderError" />
64     </root>
65 </log4j:configuration>

 

转载于:https://www.cnblogs.com/tongs/p/7347765.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值