You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by SAXESS - Hussayn Dabbous <da...@saxess.com> on 2002/07/16 11:00:46 UTC

separating mixed logmessages in multi threaded environment

when logging concurrent servlet requests, i get intermixed logging output.
I currently use NDC to mark sequences of logging messages and later apply
an offline sort on my logfile.

But i prefer to separate the logmessages right when they are created.
And i want still be able to use all the ready to use appenders available
within the log4j kit. Hence, regardless of which appender i use, it should
get messages cleanly separated on a thread by thread basis ...


My prefered solution to this problem would be as follows:

Make it configurable, which implementation of AppenderAttachable shall 
be used by Category. This would allow to replace the default
AppenderAttachableImpl instance in Category.aai by MyAppenderAttachable. 
Whenever the messages currently bufferd shall be flushed to the appenders 
my application could simply call a special (static?) method

MyAppenderAttachable.flushBuffer() (flushing buffer for current thread only)

This solution adds more flexibility than currently available in log4j, 
because i can make my own AppenderAttachable class doing whatever is 
convenient for me and the standard log4j behaviour still be kept as is ...

But before i dive deeper into this,  i'd like to know:

* Is someone already working on this problem ?
* Maybe the problem has already been solved, but i didn't see it ?
* Is this something, that could be a contribution to the log4j core ?

Any help, advice or suggestion is appreciated.


By the way, why is AppenderAttachable an interface, when on the other side
Category uses AppenderAttachableImpl which implements additional methods 
(e.g. appendLoopOnAppenders)? Why is especially appendLoopOnAppenders() not
defined in the AppenderAttachable interface where it belongs too ?

best regards, Hussayn

-- 
Dr. Hussayn Dabbous
SAXESS Software Design GmbH
Neuenhöfer Allee 125
50935 Köln
Telefon: +49-221-56011-0
Fax:     +49-221-56011-20
E-Mail:  dabbous@saxess.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>