Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log4J questions?

 
Paul Rhoades
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm about to start a project using Log4J and have a few questions...
a) Is it a good idea to have lots of loggers? I've read that people often create a logger for each class, but is this really efficient?
b) I'm guessing that an AsynchAppender is more efficient as it performs formatting in a separate thread, but is it resilient? What if the logger thread dies, do the messages get lost?
c) Any real does and don't for a performant and robust solution...
Thanks,
Paul.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i use log4j i normaly write my own logger class from which i let all my classes extend. The advantage in this case is, that i so can write the
class name to the log file. Otherwise i would have to do that manually. But so each logging entry has the class name as an identifier.
This is what worked best for me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic