开发者

Log4j threshold not working

I set the rootlogger level to debug and a package level to ERROR but still the package is logging INFO and DEBUG levels to.. Here is my log properties..

log4j.appender.rollingFile = org.apache.log4j.DailyRollingFileAppender 
log4j.appender.rollingFile.File = C:\\appl\\logs\\appdir.log
log4j.appender.rollingFile.DatePattern = '.'yyyy-MM-dd
log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout 
log4j.appender.rollingFile.layout.ConversionPattern=[%d] [%5p] [%C:%M:%L] - %m%n
log4j.rootLogger = DEBUG, rollingFile
log4j.logger.net.sf =开发者_开发技巧 WARN, rollingFile
log4j.logger.net.sf = ERROR, rollingFile

but I see lot of INFO and DEBUG messages from "net.sf" packages on log file.. how do I disable this package logging?


This may be because you've added multiple associations between your loggers and the appender. Child loggers inherit their parent's appenders, so this is simpler and expresses what you mean:

log4j.rootLogger = DEBUG, rollingFile
log4j.logger.net.sf = WARN

This will limit net.sf to WARN and above, and inherits the rollingfile appender from the root parent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜