I am using Log4j's MDC in my web applications. MDC stores context objects using ThreadLocal storage.
http://cvs.apache.org/viewcvs.cgi/jakarta-log4j/src/java/org/apache/log4 j/MDC.java?rev=1.15&view=auto -Sean > -----Original Message----- > From: Raymond DeCampo [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 17, 2003 3:58 PM > To: Log4J Developers List > Subject: NDC > > All, > > 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. > > Thanks, > Ray > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]