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

RollingFile date pattern issue

    XMLWordPrintableJSON

    Details

    • Type: Question
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.10.0
    • Component/s: None
    • Labels:
      None

      Description

      Hi,

      I run a Java app, with Log4J 2, on Linux (mainly CentOS) servers.

      Here is my configuration file:

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration shutdownHook="disable" monitorInterval="30" status="trace">
        <Appenders>
                <RollingFile name="RollingFile" fileName="/data/logs/hazelcast.log" filePattern="/data/logs/hazelcast-%d{yyyy-MM-dd}{CET}-%i.log.gz">
              <PatternLayout>
                      <Pattern>%d{yyyy-MM-dd HH:mm:ss}{CET} %-5p [%t] %C{2} (%F:%L) - %m%n</Pattern>
              </PatternLayout>
                <Policies>
                 <SizeBasedTriggeringPolicy size="15MB" />
                  <TimeBasedTriggeringPolicy />
                </Policies>
                <DefaultRolloverStrategy max="90"/>
            </RollingFile>
        </Appenders>
        <Loggers>
          <Root level="DEBUG">
            <AppenderRef ref="RollingFile"/>
          </Root>
        </Loggers>
      </Configuration>
      

      On 1 of our servers, we observe, that sometimes the rolled files are not labeled correctly: the date is far in the future.

      For example, during the first week of December, 2017, we had:

      -rw-r--r-- 1 hazelcast hazelcast  15M Dec  2 13:35 hazelcast-2058-01-24-1.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  15M Dec  2 19:15 hazelcast-2058-01-24-2.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  15M Dec  3 02:28 hazelcast-2058-01-24-3.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  15M Dec  3 12:04 hazelcast-2058-01-24-4.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  15M Dec  3 17:41 hazelcast-2058-01-24-5.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  3 22:54 hazelcast-2058-01-24-6.log.gz
      -rw-r--r-- 1 hazelcast hazelcast 5.2M Dec  4 04:12 hazelcast-2058-01-24-7.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  4 12:08 hazelcast-2058-01-26-1.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  4 18:00 hazelcast-2058-01-26-2.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  4 23:50 hazelcast-2058-01-26-3.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  5 10:27 hazelcast-2058-01-26-4.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  5 15:58 hazelcast-2058-01-26-5.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  5 20:43 hazelcast-2058-01-26-6.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  6 05:43 hazelcast-2058-01-26-7.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  6 12:35 hazelcast-2058-01-26-8.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  6 17:59 hazelcast-2058-01-26-9.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  6 23:13 hazelcast-2058-01-26-10.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  14M Dec  7 09:11 hazelcast-2058-01-26-11.log.gz
      -rw-r--r-- 1 hazelcast hazelcast  13M Dec  7 09:26 hazelcast.log
      

      The timestamps of the log lines inside the files are correct.

      Restarting the app without changing anything in the configuration or the environment solved the issue.
      It reappeared several times, without any periodicity.

      We did not managed to find a reason for that naming error.

      Any help would be greatly appreciated !

      Thanks in advance,
      Claire

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cvillard Claire Villard
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: