Hi,

This may have been asked before but I cant find it in the archives. I am
trying to use the log4j NDC class to log and distinguish between multiple
client requests coming into a single servlet instance (we are using the
frontcontroller pattern). We issue a NDC.push() at the start of the doPost
method passing in the session ID and a NDC.pop() at the end of the doPost()
method.#

As the servlet operates in the same thread and doPost() is not synchronized
isn't it quite possible that two users could get into the same method and
effectively push() two lots of information into the NDC so that the output
from log4j contains session ids from BOTH of the clients.

Apologies if I'm being stupid but if this is a problem has anyone
encountered this before and have an elegant solution?

By the way we don't really want to make the servlet implement the
SingleThreadModel or synchronize the doGet, doPost methods as we believe
this would kill the application.

Thanks in advance of any comments

Graham Mead




--
To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@;jakarta.apache.org>

Reply via email to