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

Deshui Yu commented on LOG4J2-2538:
-----------------------------------

Hi, [~garydgregory], hierarchical loggers or categories may help developer log 
message in appropriate loggers or levels, but not the same as the motivation of 
this feature request. We want a triggering mechanism to dump in memory logs to 
help developer reconstruct the context when the problem occur, which save disk 
space and bandwidth by avoiding to record unnecessary logs on disk, so 
developers will not hesitate to add enough logs can because stale log will be 
evicted from memory queue. 

> A memory appender that can be triggered to dump in-memory logging messages to 
> file
> ----------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2538
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2538
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 2.11.1
>            Reporter: Deshui Yu
>            Priority: Major
>
>   We have a problem when debugging an online production system. Our 
> production system manages and distributes data across multiple worker 
> machines. There's a bug that can cause data unbalanced placement or even 
> unavailable under heavy work load. In this scenario, DEBUG level log will 
> help us a lot to diagnose the issue. However, we cannot always set logger's 
> level to DEBUG because that will store too many logs on disk and slow down 
> the production service, especially the bug just occurs occasionally.
>   I think we can add a new type of memory appender in Log4j. This appender 
> will store log entries in a memory queue first, with a configurable maximum 
> queue size and a policy (like FIFO) to roll out stale log entry once the 
> queue is full. If any problem occurs, like some types of exception we're 
> interest is thrown, user can trigger the dump of this appender to flush in 
> memory logs into file for future diagnostic use. So it can only record 
> 'useful' DEBUG logs and related context in disk, avoid wasting disk space and 
> slowing down production service.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to