• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log4j Levels/Layer Query

 
Vaibhav G Garg
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide your inputs on this if anyone has any idea about this configuration.
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic