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 "Jack, Adam" <Ad...@New-Era-of-Networks.com> on 2001/12/08 18:21:04 UTC

NDC mix-up

Hi,

Intermittently I am seeing all the NDCs (in theoretically different threads)
in a single log entry. They seem to get mixed-up and all be displayed.

I have the following scenario:

1)	JSP pages & components in a single app server (in single VM)
	
	Log4J configure to use the SocketClient to talk to a single
SocketServer

2)	Log4J SocketServer configured to append to NT Event Log

I do this because (1) I couldn't get the NT Event Log appender to work in
the app server (long painful DLL story) and (2) to centralize things.

Now:

The app server does manage threads (& JSP pages can re-use threads that are
returned to the pool) --- but if it were something like me not cleaning the
NDC stack I'd expect one or two NDCs to get mixed-up, not all. It is all of
them.

I do configure the Log4J sub-system once, in a single thread [not once per
thread], but I get my categories within the thread I am working inside (from
the single instance of Log4J).

To push onto the NDC I do just this --- I am (from my reading) assuming that
the NDC manages a stack as a ThreadLocal object and so long as I do this in
my thread, and pop when my thread dies, then I am using NDC correctly:

                NDC.push( "Yada Yada" );

Questions:

*	Am I mis-understanding NDC usage somehow?
*	Am I doing something obviously wrong in the code?
*	Am I hitting a bug in my combination of appenders (or my
usage/configuration of them)?

Again -- this is intermittent, I can't quite track down what causes it &
when exactly it happens. Any insights appreciated.

regards

Adam
--
Open Business Interchange: <http://www.openbiz.biz>
The Revolutionary B2Bi Web Service ...


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