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

Ralph Goers commented on LOG4J2-1137:
-------------------------------------

I was thinking that when a triggering event occurs the RingBuffer would be 
swapped out and then all the events could be asynchronously logged. Ideally, 
the triggering LogEvent could be available for use in filtering events.  
However, this opens up some issues. 
1. What if a second triggering event occurs that overlaps with the first. If 
some events are filtered by the first log event they wouldn't be in the output 
for the second.
2. What if triggering events happen too quickly. There should be some way to 
detect this and just bypass the buffer for some amount of time.

Yes, I was thinking the Distruptor's RingBuffer might work for this.



> Allow events to be buffered until something triggers and causes them to be 
> logged.
> ----------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1137
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1137
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 2.4
>            Reporter: Ralph Goers
>
> In many cases logging is filtered in production to reduce the overhead of 
> logging. Unfortunately, this means that when an error occurs there may not be 
> enough logging information available to diagnose the problem. On the other 
> hand, if filtering is minimized then the amount of data being logged can be 
> overwhelming.
> This enhancement would allow log events to be written to a buffer and not 
> processed any further until a triggering event occurs. Once that trigger 
> occurs all the events in the buffer would be logged in sequence and pass 
> through the normal filtering process.  Some log events that are deemed 
> "special" would need to be allowed to bypass the buffer and immediately be 
> processed.
> One way to accomplish this would be to add a new LogBuffer component to the 
> configuration. If configured, the ReliabilityStrategies could be modified to 
> work with the LogBuffer or a BufferingReliabilityWrapperStrategy could be 
> created to wrap the existing strategies.
> Note - no code has been written for this yet. I'd want to figure out what the 
> configuration might look like before starting.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to