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

RollingFileAppender ignores TimeZone-Pattern

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.14.0
    • None
    • Appenders
    • None

    Description

      Configuration

      <RollingFile name="RollingFile" filePattern="log-%d{yyyy-MM-dd-HHZ}.log.gz">
      <PatternLayout>
      <Pattern>%d %-5p [%t] %C{2} (%F:%L) - %m%n</Pattern>
      </PatternLayout>
      <Policies>
      <CronTriggeringPolicy schedule="0 0 * * * ?"/>
      </Policies>
      </RollingFile>

      Result

      2021-03-10 11:00:00,088 ... DEBUG Setting prev file time to 2021-03-10T10:00:00.000+0100
      2021-03-10 11:00:00,088 ... DEBUG Rolling log-2021-03-10-10+0100.log
      2021-03-10 11:00:00,088 ... DEBUG Formatting file name. useCurrentTime=false. currentFileTime=1615366800000, prevFileTime=1615366800000
      2021-03-10 11:00:00,088 ... DEBUG Found 0 eligible files, max is 2147483647
      2021-03-10 11:00:00,111 ... DEBUG OutputStream closed
      2021-03-10 11:00:00,111 ... DEBUG RollingFileManager executing async GzCompressAction[log-2021-03-10-10+0100.log to Logs/opc-xml-da2-2021-03-10-10+0100.log.gz, deleteSource=true]
      2021-03-10 11:00:00,196 ... DEBUG Formatting file name. useCurrentTime=false. currentFileTime=1615366800000, prevFileTime=1615366800000
      2021-03-10 11:00:00,196 ... DEBUG Formatting file name. useCurrentTime=true. currentFileTime=1615366800000, prevFileTime=1615366800000
      2021-03-10 11:00:00,196 ... DEBUG Now writing to log-2021-03-10-10+0100.log at 2021-03-10T11:00:00.196+0100
      2021-03-10 11:00:00,199 ... DEBUG Log4j2 ConfigurationScheduler Cron expression 0 0 * * * ? scheduled to fire again at 2021-03-10T12:00:00.000+0100

       

      Local time is GMT+1 (Berlin), at program start log4j calculates the correct filename, but at rollup, it works with the local time zone and ignores the time zone pattern from the configuration.

      Attachments

        Issue Links

          Activity

            People

              ckozak Carter Kozak
              de-ka D. Kahlert
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: