Tomcat:按记录器名称过滤log4j [英] Tomcat: Filter log4j by logger name
本文介绍了Tomcat:按记录器名称过滤log4j的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用一个非常冗长地使用log4j的外部软件包.我查看了代码,发现了预期的log4j
行:
I am working with an external package which uses a log4j quite verbosely. I've looked at the code and found the expected log4j
lines:
private Logger log = Logger.getLogger("SomeLoggerName");
...
log.info("Trivial message");
log.info("More trivial data");
由于我无法更改代码,因此我尝试更改log4j.xml
:
Since I can't change the code, I've tried to change log4j.xml
:
<category name="SomeLoggerName">
<level value="${log4j_level:-WARN}"/>
<appender-ref ref="FileLogger"/>
</category>
我猜想category name
属性等效于记录器名称.是真的吗如果没有,如何按记录器名称过滤?
I guessed thatcategory name
property is equivalent to the logger name. Is it true? If not, how can I filter by logger name?
推荐答案
您说得对,记录器==类别.您的配置有问题吗?通常看起来不错,应该可以.
You are right, logger == category. Do you have problems with your configuration? Generally it looks OK and should work.
这篇关于Tomcat:按记录器名称过滤log4j的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文