1 ### 设置###
2 log4j.rootLogger = debug,stdout,D,E
3
4 ### 输出信息到控制台 ###
5 log4j.appender.stdout = org.apache.log4j.ConsoleAppender
6 log4j.appender.stdout.Target = System.out
7 log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
8 log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n
9
10 ### 输出DEBUG 级别以上的日志到=D://logs/error.log ###
11 log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
12 log4j.appender.D.File = D://logs/log.log
13 log4j.appender.D.Append = true
14 log4j.appender.D.Threshold = DEBUG
15 log4j.appender.D.layout = org.apache.log4j.PatternLayout
16 log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
17
18 ### 输出ERROR 级别以上的日志到=D://logs/error.log ###
19 log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
20 log4j.appender.E.File =D://logs/error.log
21 log4j.appender.E.Append = true
22 log4j.appender.E.Threshold = ERROR
23 log4j.appender.E.layout = org.apache.log4j.PatternLayout
24 log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n