At 10:38 PM 6/11/2004, you wrote:
What about static objects in the JVM? Would each Servlet get their own instance of X or will it get the static one?
What do you mean by static objects in the JVM
If the Servlet spawned off threads? Then it should still work because you have not changed the TL.
Does that sound right? I was just trying to mentally think what will happen when servlet 2 comes up.
servlet1 sets the TL to "servlet1" servlet 1 creates an instance of X, say x1 while constructing x1, x1 reads TL, the read value is "servlet1" the constructor retrieves a logger whose name depends on the value of TL servlet 1 calls a method on x1, say foo() x1.foo() logs with that logger specific to the x1
servlet2 sets its TL to "servlet2" servlet2 creates an instance of X, say x2 while constructing x2, x2 reads TL, the read value is "servlet2" the constructor retrieves a logger whose name depends on the value of TL servlet2 calls a method on x2, say foo() x2.foo() logs with the logger specific to the x2
x1.foo() eventually returns servlet1 eventually returns, before returning it sets TL to null
x2.foo() eventually returns servlet2 eventually returns, before returning it sets TL to null
Are you familiar with thread local variables? If not, invest a few minutes to experiment.
http://java.sun.com/j2se/1.3/docs/api/java/lang/ThreadLocal.html
-- Ceki Gülcü
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]