Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2031

Messages appear out of order in log file (was: Log4j2 log file not reflecting application log function calls)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.2, 2.9.0, 2.9.1
    • 2.10.0
    • Appenders
    • None
    • Windows, Sun Java 8.

    • Important

    Description

      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.

      Attachments

        1. CapacityTest.java
          3 kB
          Colin McDowell
        2. log4j2.xml
          1 kB
          Colin McDowell
        3. pom2.xml
          4 kB
          Colin McDowell

        Issue Links

          Activity

            People

              rpopma Remko Popma
              colinarity Colin McDowell
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 672h
                  672h
                  Remaining:
                  Remaining Estimate - 672h
                  672h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified