如何关闭log4j警告? [英] How to turn off log4j warnings?

查看:822
本文介绍了如何关闭log4j警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个Java应用程序,它取决于使用log4j的几个库(Axis2)。我不使用log4j,也没有任何配置文件。我想完全禁用log4j并压制它吐出的任何和所有警告。现在,当我运行我的应用程序时,当我调用其中一个库的方法时,我看到:

I'm running a Java app that depends on a few libraries (Axis2) which use log4j. I don't use log4j and don't have any configuration file. I'd like to just completely disable log4j and squelch any and all warnings that it spits out. Right now, when I run my app, when I call one of the library's methods, I see:

log4j:WARN No appenders could be found for logger 
(org.apache.axis2.deployment.FileSystemConfigurator).
log4j:WARN Please initialize the log4j system properly.

我可以调用一些静态log4j禁用方法吗?我尝试了Logger.getRootLogger()。removeAllAppenders();这不起作用(我仍然看到警告)。

Is there some static log4j disable method I can call? I tried Logger.getRootLogger().removeAllAppenders(); and this did not work (I still see the warnings).

推荐答案

你可以尝试

Logger.getRootLogger().setLevel(Level.OFF);

这篇关于如何关闭log4j警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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