You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Scott Sue (JIRA)" <ji...@apache.org> on 2018/02/08 06:58:02 UTC

[jira] [Commented] (LOG4J2-2031) Messages appear out of order in log file (was: Log4j2 log file not reflecting application log function calls)

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

Scott Sue commented on LOG4J2-2031:
-----------------------------------

Hi all,

Sorry to resurrect an old Jira but this is the most appropriate place to comment on this.  I've been looking into this as well and my opinion is that blocking the application due to the ring buffer being full is dangerous.  We log our message our to the KafkaAppender so we are at the mercy of the network.  If we have sustained logging there can be a chance that the ringbuffer is full.  Once full as per the change above, we will block.  Logging in my opinion is very important, however it should not block the application from running.

I think your suggestion is good regarding marking out of order messages in the logs so it at least gives the logs reader a chance to determine that a given message is out of order.

Another potential solution (not sure if it is feasible, or a good idea) would be to have a hybrid of a Queue and ringbuffer? So if the ringbuffer is full it will write the message into the Queue instead (therefore bound by memory).  Once the ringbuffer empties, we can also start draining the Queue to maintain log order?

 

Thoughts?

> Messages appear out of order in log file (was: Log4j2 log file not reflecting application log function calls)
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2031
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2031
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.8.2, 2.9.0, 2.9.1
>         Environment: Windows, Sun Java 8.
>            Reporter: Colin McDowell
>            Assignee: Remko Popma
>            Priority: Major
>             Fix For: 2.10.0
>
>         Attachments: CapacityTest.java, log4j2.xml, pom2.xml
>
>   Original Estimate: 672h
>  Remaining Estimate: 672h
>
> Was hoping to move our numerous J2EE projects from Log4j to Log4j2 for the performance improvements.  I put together a small test case that writes a string pattern to a Rolling File.  There is a 6 digit sequence number at the start of the log message.  This allows me to quickly see if all the log requests are making it into the log file. I attach the test case and log4j2.xml.  The log4j2.xml uses an asynchronous appender.
> What I observe in the output log file is that after a short interval (120 or so entries) the logged are appearing in the wrong order, and entries can be missing.  The missing entries issues especially shows up when rolling to the next log file.
> Perhaps there is a deliberate decision to not to guarantee log file accurately for speed.  However we need the logs to accurately reflect what the application is logging.  I have also noticed the performance is 25% worse in Log4j2 than Log4j when not using the asynchronous appender.  So that rather kills us using Log4j2 at the moment.



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