log4j rootlogger关闭某些类的记录器 [英] log4j rootlogger turn off logger for some classes
问题描述
如何使用rootlogger = debug, stdout, logfile
配置log4j.properties
和org.apache.httpclient = debug
哪个进入日志文件而不是stdout?
how can i configure a log4j.properties with a rootlogger = debug, stdout, logfile
and org.apache.httpclient = debug
which goes into the logfile but not the stdout?
将rootlogger提升为信息是不可接受的,因为我在调试级别有其他软件包.
raising the rootlogger to info is not acceptable as i have others package at the debug level.
推荐答案
在log4j.properties
文件中,添加以下行
log4j.logger.org.apache.httpclient=DEBUG, logfile
将org.apache.httpclient
记录器的输出定向到logfile
附加器.
to direct the org.apache.httpclient
logger output to the logfile
appender.
还包括一行
log4j.additivity.org.apache.httpclient=false
防止org.apache.httpclient
记录器的输出发送到rootLogger
的附加程序.
to prevent the org.apache.httpclient
logger output going to the rootLogger
's appenders.
这篇关于log4j rootlogger关闭某些类的记录器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!