In the following method in LoggingEvent.java public void getMDCCopy() { if(mdcLookupRequired) { ndcLookupRequired = false; // the clone call is required for asynchronous logging. // See also bug #5932. Hashtable t = (Hashtable) MDC.getContext(); if(t != null) { mdcCopy = (Hashtable) t.clone(); } } } ndcLookupRequired is set to false when it should be mdcLookupRequired which is set to false.
Good catch! I'll fix it immediately and will release log4j 1.2.1 afterwards. By the way, did you detect this bug by reading the code or by observing at deployment time? Regards, Ceki ps: I'll also add a test case in order detect such silly errors as early as possible.
I spotted this reading the code (or rather using find). I don't think that this would actualy have an issue in a deployed system. The only issues would be if you called getMDCCopy() before calling getNDC() which would then not cache the NDC localy. However you don't do that so it should be ok.