Reputation: 4150
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?
Upvotes: 0
Views: 1855
Reputation: 547
LOG4J is designed in a pattern of systematic hierarchical structure, by the order of its names given.
Following image depicts the hierarchical representation of loggers
log4j.logger.com.my.package
in your case, and override the specific configuration of the child loggers.Ref Link
Upvotes: 0
Reputation: 17455
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 .
Upvotes: 4