You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Andrew B <ch...@yahoo.com> on 2001/10/15 18:05:57 UTC

using log4j in multithreaded environment

Hi,

Is there an appender that allows all the output from
each thread to be grouped together? I have a
multithreaded web server environment (Tomcat), as do
many of you I suspect, and would like to use log4j
server-side. The manual discusses multithreading, and
suggests not using a category for each thread, but
using the NDC instead with the thread ID.

However, this won't produce the result I am looking
for: the ability to have the output from each thread
grouped together instead of interleaved with that of
other threads. For example, assuming concurrent
threads:

Normal output:
Thread-1: start request
Thread-2: start request
Thread-1: end request
Thread-2: end  request

Desired output:
Thread-1: start request
Thread-1: end request
Thread-2: start request
Thread-2:  request

I realise that to do this you would somehow have to
tell it to start buffering at the start of the request
and flush at the end. Would subclassing an appender
work? Is there already an appender for this?

Thanks,

Andrew Broderick



=====
The geek shall inherit the earth.

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org