Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 0.9.7
-
Fix Version/s: 0.9.8
-
Component/s: Perf4j log4j extensions
-
Labels:None
-
Environment:log4j
-
Number of attachments :
Description
The AsyncCoalescingStatisticsAppender used a PipedWriter/PipedReader combo to send log messages from the logging thread to the asynchronous draining thread. However, PipedReader uses a bounded queue, and if this queue fills up (which happens when the Dispatcher thread doesn't get enough processing time to drain the queue), then calls to log can slow down as they wait for the queue to drain.
We should replace the PipedWriter/Reader queue with an ArrayBlockingQueue that simply discards messages if the queue becomes full.
Now using an ArrayBlockingQueue - thanks to Nicholas Whitehead for the suggested fix. The queue size can be set as an appender option, and discarded messages are counted and can be accessed using the getNumDiscardedMessages() method on the appender.