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

File rollover fails with error due to invalid previous file log names

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.2
    • Fix Version/s: 2.13.1
    • Component/s: None
    • Labels:
      None

      Description

      Hi,

      Not sure if you want to fix this or not. I noticed the following error and logs fail to rollover and causes a problem. It could cause a problem i guess if someone makes some kind of mistake of file suffix during support. Maybe you want to just skip those invalid files? It seems like it was a recent log4j2 change (maybe 2.8.x) since these files have been there since 2016 and previous log4j2 versions didn't complain. Looks like maybe support renamed some previous log files to have unix system time in the suffix like file.log.1457052422478.

      2017-09-08 09:31:01,111 Log4j2-TF-1-AsyncLogger[AsyncContext@33909752]-1 ERROR An exception occurred processing Appender AppLogFile java.lang.NumberFormatException: For input string: "1457052422478"
              at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
              at java.lang.Integer.parseInt(Integer.java:583)
              at java.lang.Integer.parseInt(Integer.java:615)
              at org.apache.logging.log4j.core.appender.rolling.AbstractRolloverStrategy.getEligibleFiles(AbstractRolloverStrategy.java:130)
              at org.apache.logging.log4j.core.appender.rolling.AbstractRolloverStrategy.getEligibleFiles(AbstractRolloverStrategy.java:98)
              at org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy.purgeDescending(DefaultRolloverStrategy.java:269)
              at org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy.purge(DefaultRolloverStrategy.java:199)
              at org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy.rollover(DefaultRolloverStrategy.java:326)
              at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:362)
              at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:278)
              at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.checkRollover(RollingFileManager.java:218)
              at org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender.append(RollingRandomAccessFileAppender.java:207)
              at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
              at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
              at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
              at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
              at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:448)
              at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:433)
              at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
              at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:79)
              at org.apache.logging.log4j.core.async.AsyncLogger.actualAsyncLog(AsyncLogger.java:337)
              at org.apache.logging.log4j.core.async.RingBufferLogEvent.execute(RingBufferLogEvent.java:161)
              at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:45)
              at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:29)
              at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:129)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      

        Attachments

          Activity

            People

            • Assignee:
              rgoers Ralph Goers
              Reporter:
              leonfin Leon Finker
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: