On Jan 17, 2007, at 8:35 AM, xx xx wrote:
Hi,
I use a log4cxx::Logger component in a multi-threaded environment.
Is it possible to force a number of messages from a single thread
to appear consecutively in the target appender ?
So they won't be "scrambled" with messages sent from other threads
and no messages will be lost, (internal lock in Logger?).
It may be possible to write a custom appender to do that, but as far
as I know there is no existing capability. It sounds like a very
hard thing to generalize, you would either need to cache logging
requests from different threads and then have some criteria when to
switch from writing one threads requests to writing the others. I'd
suggest you post process or otherwise filter the log file for your
analysis instead of trying to force an unnatural order while it is
being written.