开发者

Log4j Multiple Threads

开发者 https://www.devze.com 2023-04-09 10:51 出处:网络
I am adding ConsoleAppender to rootlogger for log4j as BasicConfigurator.configure(new ConsoleAppender(layout, \"System.err\"));

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消