On Mar 5, 2005, at 7:34 AM, Keith Rogers wrote:

I'm using log4j 1.2.8, and am having a problem with LoggingEvent's
getThreadName method - it is always returning the name of the thread
that I call the getThreadName method from, rather the name of the thread
that created the log event.


Having had a look at the source, it seems to me that the threadName
field is not set in either of the constructors, so the getThreadName
method simply reverts to its null value behaviour - the name of the
calling thread.

I also noticed that while a timeStamp field is set in the constructors,
I can't find a corresponding getTimeStamp method.

I'm reasonably sure that I must be doing something wrong, or looking in
the wrong place... but can anyone help?


Sorry I don't have the 1.2.x series around, but I think the concepts are the same. The assumption is that a LoggingEvent is "rendered" before being made accessible to another thread (or serialized) etc. In 1.3, this is done by LoggingEvent.prepareForDeferredProcessing which is called, for example, in AsyncAppender.doAppend before placing the event in the queue. That method is marked as a 1.3 method, but there should be a 1.2 predecessor. The idea was to avoid the cost of "rendering" the thread name until it was requested in synchronous processing or just before the information became unavailable.



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to