logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raymond DeCampo <rdeca...@twcny.rr.com>
Subject NDC
Date Wed, 17 Dec 2003 23:58:07 GMT

I was recently thinking about adding some NDC logging to my servlet, but 
I was concerned (perhaps unnecessarily) by some of the things I read in 
the docs and the source code.

Since I am in a servlet container I am not in control of my threads.  So 
it is difficult to know when to call NDC.remove().  It seemed like it 
would be safe to call at the end of every request.

However, when I was looking over the implementation, I was concerned 
that it may be a performance issue, especially if there are a lot of 
requests and threads.  I can see that whoever wrote the code was 
concerned as well.  (In particular I am thinking of the comment 
concerning the synchronization of the ht variable.)

I think that the NDC class could be much improved through the use of the 
ThreadLocal class.  I just checked the docs and ThreadLocal has been 
available since JDK 1.2; if I'm not mistaken that is the threshold we 
are working for?

Before I put any serious effort forward I wanted to make sure that such 
a change would fit in in terms of the overall vision and that I'm not 
missing something else that would prevent it being accepted.  If one of 
the committers could confirm that it seems like a good idea, I'll start 
working on it.


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

View raw message