RE: Using MDC on an application server with thread pools
Yogesh Rao <Yogesh.Rao <at> mphasis.com>
2009-12-04 19:05:50 GMT
Hi,
Servers never guarantees that thread allocated to a request from client would be given the same thread on
subsequent requests from the client. Hence its advisable to clear out the mdc info before the request
ends(preferable)or in case you wouldn't like to clean up then make sure you overwrite it every time to get
the correct output.
Hope this helps!!
Cheers!
-----Original Message-----
From: Renan Vinícius Mozone [mailto:renan.mozone <at> gmail.com]
Sent: Fri 12/4/2009 11:19 PM
To: log4j-user
Subject: Using MDC on an application server with thread pools
On my web application (it uses JSP pages) I'm using the MDC to put the
the sessionid on the log records, but i'm facing a problem. The application
server is IBM WebSphere 6.1 and it uses thread pools. So, sometimes, the
thread for some sessions is changed (the pool allocate another thread to
continue the session) and since the MDC is thread based, in this cases I'm
getting a incorrect session on the log records. The log's are scrambled now.
Any suggestions?
Information transmitted by this e-mail is proprietary to MphasiS, its associated companies and/ or its
customers and is intended
for use only by the individual or entity to which it is addressed, and may contain information that is
privileged, confidential or
(Continue reading)