Sirish Kumar Bethala
Sirish Kumar Bethala

Reputation: 9269

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 configuration? How can I debug this?

Upvotes: 1

Views: 5418

Answers (1)

Matthew Farwell
Matthew Farwell

Reputation: 61705

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.

Upvotes: 4

Related Questions