简体   繁体   English

确定Log4J根记录器是否打开

[英]Determine if Log4J root logger is on

Is there a way to determine if the Root logger is on? 有没有办法确定Root记录器是否打开?

File log4j.properties : 文件log4j.properties

log4j.rootLogger=OFF

I know that I can check if a level is on using: 我知道我可以检查某个级别是否正在使用:

LOG.isDebugEnabled()

But there doesn't seem to be a good way to determine if the root logger is off. 但是,似乎没有确定root logger是否关闭的好方法。 I need to know this from an auditing perspective to determine if there has been some tampering. 我需要从审计的角度来了解这一点,以确定是否存在一些篡改行为。

只需获取root记录器并询问状态:

LoggerFactory.getLogger("root").isDebugEnabled()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM