At 05:30 AM 4/15/2005, Rohit Sonalkar wrote:
Hi,

Is it possible in a multi-threaded application that log statements
appear in the output log file out of sequence w.r.t. the timestamps of
the logging events? If the timestamp is generated at the time the
logging method is invoked, then under what conditions would this happen?
Would it happen if a logger generated a logging event, but by the time
it found its way to its parent categories' appender through additivity,
the logger directly attached to that appender gets in a logging event?


I believe the short answer to be 'yes'. The longer answer follows.

The creation of the logging event which contains the time stamp and
actual writing of the event through the appenders is not
atomic. However, all the appenders attached to a given logger are
invoked atomically.

Thus, it possible for the time stamps of distinct events to be written
in different order through appender A and appender B but only if
appenders A and B are attached to distinct loggers. If A and B are
attached to the same logger, then all events output through appender A
will be output exactly in the same order in B, provided that both A
and B log the event.

Although related, there is also the separate question mentioned by
Curt, that is the order in which events occur and the order in which
they are output by log4j as epitomized by the AsyncAppender reordering
problem when its buffer is full.

HTH,


Thanks

Rohit

-- Ceki Gülcü

  The complete log4j manual: http://www.qos.ch/log4j/



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



Reply via email to