Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j.xml logger name

 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In every example I can find, a logger "name" references a package - ex. com.foo.

What if I want to give the logger an arbitrary name so that any class can call a logger?

Is this good design?

Thanks
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read the log4j short manual where it discusses the advantages of a hierarchical naming convention for loggers?

At a very minimum use of different logger names helps me decipher where the logging comes from when trying to troubleshoot an issue from the logs (without the performance hit of logging more detailed information about class or other location information). It is useful to apply different logging levels to different loggers and to route different messages into different destinations.

Of course, it is OK to use another naming system that fits your needs.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic