Closed
Description
Description
If the user uses both an AsyncLoggerContext
(which makes all loggers to be of type AsyncLogger
) and AsyncLoggerConfig
, a race condition can occur, which causes context data to be lost.
Details
If both AsyncLogger
and AsyncLoggerConfig
are used together (which is no advised, but possible and there is a test for it):
AsyncLoggerConfig#log
is called from the main disruptor thread with aRingBufferLogEvent
argument,AsyncLoggerConfig
callsRingBufferLogEvent#createMemento()
before sending the event to its own disruptor thread. However this method does not make a copy of the context data, nor does it mark the data as "frozen",- A
RingBufferLogEvent#clear()
on the main disruptor thread clears the context data. If the disruptor thread ofAsyncLoggerConfig
didn't log the message yet, it will log it without context data.