https://issues.apache.org/bugzilla/show_bug.cgi?id=50486

--- Comment #45 from [email protected] ---
(In reply to comment #44)
> Thanks Stephan, I agree with you guys. I will use your code snippet for the
> FAQ.

While Stephan's code certainly is correct (actually, log4j could provide that
filter) and does the job I wouldn't be happy to see this mentioned prominently
in the FAQ. 

You should make clear to users that if using Servlet filters the proper pattern
is something like

try {
    MDC.put(myKey);
    chain.doFilter(request, response);
} finally {
    MDC.remove(myKey);
}

With Stephan's filter you have to be careful to configure it in the right
position in web.xml (they're processed sequentially in configuration order). If
the filter runs before the last piece of code that depends on the MDC is
completed you're in trouble.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to