We are using the log4j for logging purpose in our web application project. Currently, we are using the same level of logging (debug, info etc.) across all the layers. But, now we would like to enable the different levels of logging at different layers (in the same log file). Please suggest if this is possible or not. And if yes, then what is the approach?
Vaibhav G Garg
Joined: Sep 23, 2011
Please provide your inputs on this if anyone has any idea about this configuration.
When you create a Logger or Category instance, you give it a String name. You can change Log4j's configuration to throttle the output from a particular name, or an entire branch of a hierarchy (Log4j names can use dot notation like Java package names). The common practice is to use the class name as the name for the Logger, then you can pick individual classes or packages to get more/less information on in your configuration.
The documentation has some examples.