> From: [EMAIL PROTECTED]
> 
> MDC seems to work inproperly with AsyncAppender.
> 
> I have a custom appender that reads some entries from the MDC, and writes
> them to a database. If I use it with the AsyncAppender, the MDC information
> is sometimes wrong.
> 
> The problems seems to be that LoggingEvent.getMDCCopy() doesn't actully
> create a copy of the hashtable, but just gets a reference to it.
> 
> If you modify LoggingEvent.getMDCCopy like this...
> 
> 203c203
> <         mdcCopy = (Hashtable)MDC.getContext().clone();
> ---
> >         mdcCopy = MDC.getContext();
> 

Heikki,

I think that you need to consider that the problem might be that the clone
method is implemented as a shallow copy instead of a deep copy, i.e., the
default processing of the clone method is to copy references and not the object
themselves or copy the primitives value. You should look at the implementation
of the Context class, (and all it sub-classes), clone method to determine that
this is not the case.

--Claudio

> ... it starts working.
> 
> - Heikki 
> 
> --
> 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]>

Reply via email to