Log4j登录所有类级别 [英] Log4j Log at all Classes Level
问题描述
我正在使用Log4j调试我的Java Web应用程序,我需要登录Class Level。我不想在我的log4j.properties文件中为每个类添加一行,因为我在我的应用程序中有数百个类,如下所示:
I am Debugging my Java Web Application Using Log4j, I need to Log At Class Level. I do not want to put a line for each Class in my log4j.properties file as I have hundreds of classes in my application like this:
log4j.logger.com.my.package.class1=DEBUG
log4j.logger.com.my.package.class2=DEBUG
log4j.logger.com.my.package.class3=DEBUG
是否有一行设置来实现所有类的登录?
Is there a one line setup to Achieve loggin for all the Classes?
推荐答案
所有记录器按名称排序到层次结构中。因此,如果需要,您可以配置父记录器(log4j.logger.com.my.package或根记录器)并覆盖某些子记录器的配置。有关详细信息,请参阅 http://logging.apache.org/log4j/2。 x / manual / architecture.html 。
All loggers are ordered into a hierarchy, by its names. So you may to configure a parent logger ("log4j.logger.com.my.package" or root logger) and override configuration for some of child loggers if you need. See more at http://logging.apache.org/log4j/2.x/manual/architecture.html .
这篇关于Log4j登录所有类级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!