This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Log4J questions? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4J questions?" Watch "Log4J questions?" New topic

Log4J questions?

Paul Rhoades

Joined: Aug 01, 2002
Posts: 20
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...
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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.
I agree. Here's the link:
subject: Log4J questions?