log4j基本配置 [英] log4j basic configuration
本文介绍了log4j基本配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用log4j在应用程序中记录了一些步骤.为了快速而肮脏,我使用了:
I used log4j to log some steps in my application. To be quick and dirty, I used:
org.apache.log4j.BasicConfigurator.configure();
这将在Eclipse控制台中输出我的日志.
This output my logs in the Eclipse console.
我想知道是否以及如何将级别阈值设置为高于DEBUG?换句话说,我不想显示DEBUG级别的消息,只显示ERR,WARN和INFO.
I want to know if and how to set the level threshold higher than DEBUG? In other word, I do not want to display DEBUG level message, just ERR, WARN, INFO.
谢谢.
我可以在下面使用这个吗?
May I use this following?
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
[...]
Logger logger = Logger.getLogger(this.class);
logger.setLevel(Level.INFO);
推荐答案
我认为最简单的方法是:
I think the simplest way would be:
Logger.getRootLogger().setLevel(Level.INFO);
这篇关于log4j基本配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文