aspose file tools*
The moose likes Other Open Source Projects and the fly likes Log4j Levels/Layer Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4j Levels/Layer Query" Watch "Log4j Levels/Layer Query" New topic
Author

Log4j Levels/Layer Query

Vaibhav G Garg
Ranch Hand

Joined: Sep 23, 2011
Posts: 140
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
Ranch Hand

Joined: Sep 23, 2011
Posts: 140
Please provide your inputs on this if anyone has any idea about this configuration.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8910
    
    8

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
Don't get me started about those stupid light bulbs.
 
subject: Log4j Levels/Layer Query