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.
posted 14 years ago
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.