On Feb 19, 2005, at 11:23 AM, Ana Paula Brandão Lopes wrote:
Hello,
I was learning about using NDC to diferentiate logging coming from diferente clients on web-apps, by reading this: http://www.onjava.com/pub/a/onjava/2002/08/07/log4j.html?page=3
The docs say every thread has its own NDC, but when the logging is sent, the appender is the same for all threads. I was looking for "synchronized" on logging methods (like Logger.debug(), or Logger.info()) or even on Appenders methods, but couldnīt find it.
This made me wonder. Is logging on log4j thread-safe?
Thanks in advance,
Ana
See http://logging.apache.org/log4j/docs/faq.html#1.7
It would be undesirable to have synchronized on the logging methods since that would block other threads from logging for the time it takes to complete the entire logging operation. If you search the log4j code base, you will many synchronization blocks that prevent conflicting access to the same shared resources, however they are designed to allow as much non-conflicting access as possible and to minimize the duration other threads may be blocked.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]