log4j rootlogger关闭某些类的记录器 [英] log4j rootlogger turn off logger for some classes

查看:364
本文介绍了log4j rootlogger关闭某些类的记录器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆