一般写法的话,error日志只有error,但是info日志也会包含error
log4j.appender.File2=org.apache.log4j.DailyRollingFileAppender log4j.appender.File2.File=alfresco2.log log4j.appender.File2.Append=true log4j.appender.File2.DatePattern='.'yyyy-MM-dd log4j.appender.File2.layout=org.apache.log4j.PatternLayout log4j.appender.File2.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
#配置Filter #定义id为F1的拦截器,只接受INFO到ERROR log4j.appender.File2.filter.F1=org.apache.log4j.varia.LevelRangeFilter log4j.appender.File2.filter.F1.LevelMin=INFO log4j.appender.File2.filter.F1.LevelMax=ERROR
#定义id为F2的拦截器,不接受WARN log4j.appender.File2.filter.F2=org.apache.log4j.varia.LevelMatchFilter log4j.appender.File2.filter.F2.levelToMatch=WARN log4j.appender.File2.filter.F2.acceptOnMatch=false #可以继续定义你需要的拦截器F3/F4.....
级别大小: public static final int OFF_INT = 2147483647; public static final int FATAL_INT = 50000; public static final int ERROR_INT = 40000; public static final int WARN_INT = 30000; public static final int INFO_INT = 20000; public static final int DEBUG_INT = 10000; public static final int ALL_INT = -2147483648;
debug最小,所以代码里用log.info打日志的话,info>debug, 所以你的appender如果是debug的话,会把info日志也打出来。
|