[ 
https://issues.apache.org/jira/browse/LOG4J2-1761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15833558#comment-15833558
 ] 

Kim Northrop commented on LOG4J2-1761:
--------------------------------------

When asynchronous processing of log messages is used for performance reasons 
then it makes sense to do as little work as possible in the thread in which the 
log message originates. Therefore the developers of log4j2 have put a lot of 
work into creating the asynchronous logger. This good work could be developed 
further by allowing the user to choose the implementation of the queuing 
mechanism; first, for symmetry: this choice exists already for the asynchronous 
appender, and second, for memory: for instance in web applications where the 
default ring buffer size for the disruptor is much smaller than in standalone 
applications the user, instead, could choose one of the queues that need less 
memory.

To get a rough idea how much work this would mean I created a prototype and 
attached the files where:
log4j2 class RingBufferLogEvent becomes the new class AsyncLogEvent,
log4j2 class AsyncLogger becomes the new class AsyncLoggerWithQueue,
log4j2 class AsyncLoggerContext becomes the new class 
AsyncLoggerWithQueueContext,
log4j2 class AsyncLoggerContextSelector becomes the new class 
AsyncLoggerWithQueueContextSelector,
and the queuing mechanism is implemented in class QueueWrapper and in the 
classes QueueWrapperCLQ, QueueWrapperLBQ, QueueWrapperLTQ.

I would be pleased if one of the developers of log4j2 would have a look at the 
files to decide on the proposal.

> Support for standard java queues for the async logger
> -----------------------------------------------------
>
>                 Key: LOG4J2-1761
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1761
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.7
>            Reporter: Kim Northrop
>            Priority: Minor
>         Attachments: AsyncLogEvent.java, AsyncLoggerWithQueueContext.java, 
> AsyncLoggerWithQueueContextSelector.java, AsyncLoggerWithQueue.java, 
> QueueWrapperCLQ.java, QueueWrapper.java, QueueWrapperLBQ.java, 
> QueueWrapperLTQ.java
>
>
> Please add support for standard java queues (LinkedTransferQueue, 
> ArrayBlockingQueue, LinkedBlockingQueue, ConcurrentLinkedQueue) to the async 
> logger. I will attach some classes for usage with System properties 
> (Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerWithQueueContextSelector,
>  LoggerQueue.Capacity=<capacity>, LoggerQueue.Type=<currently one of 
> LinkedTransferQueue, ConcurrentLinkedQueue, LinkedBlockingQueue>). Since most 
> of these queues allocate new nodes for new elements I have not implemented 
> usage of thread locals for the log events.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to