Log4j Multiple Threads
I am adding ConsoleAppender to rootlogger for log4j as
BasicConfigurator.configure(new ConsoleAppender(layout, "System.err"));
But somehow log messages in some loggers down the hierarchy are not reaching console. I have not seen any instance in the hierarchy setting the additivity flag as false.
Some loggers are running in different threads, do you I need to do any con开发者_StackOverflow中文版figuration? How can I debug this?
Log4j is thread-safe. See Is log4j thread-safe?. You should not need any special configuration for multi-threading.
However, the messages can appear in a mixed-up order from different threads, so check that they aren't somewhere else in the logs.
精彩评论