I think you should look into creating a special appender that can sort through your NDC information and forward to an appropriate destination, like a file for each thread (or something). Another option might be to have multiple appenders with filters attached to them to accept some messages but block others.
-Mark > -----Original Message----- > From: SAXESS - Hussayn Dabbous [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 2:01 AM > To: [EMAIL PROTECTED] > Subject: 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: [EMAIL PROTECTED] > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>