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

fileName variables not re-resolved at file rollover

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • Appenders
    • None
    • Important

    Description

      The configuration is not resolved when file rolls over at the end/start of the day.

      Expected: when the file rolls over, I would expect that the variables in fileName configuration would be resolved again to its current values and a new file created in a folder for the current day. I.e. the logs are always written to the directory for the current date.

      Actual: logging continues using the file that was created at startup. I.e. in the folder for the day the application was started.

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration status="INFO">

      <Appenders>

      <RollingRandomAccessFile name="File"
      fileName="c:/temp/${date:yyyyMMdd}/App-${date:yyyyMMdd_HHmmss}.log"
      filePattern="c:/temp/$${date:yyyyMMdd}/App-%d

      {yyyyMMdd}

      -%i.log.zip"
      immediateFlush="false"
      append="true">

      <PatternLayout>
      <Pattern>%-5p %d

      {HH:mm:ss,SSS}

      [%t] [%c

      {1}

      ] (%F:%L) - %m %n</Pattern>
      </PatternLayout>

      <Policies>
      <OnStartupTriggeringPolicy />
      <TimeBasedTriggeringPolicy />
      </Policies>

      </RollingRandomAccessFile>

      </Appenders>

      <Loggers>
      <Root level="INFO">
      <AppenderRef ref="File" />
      </Root>
      </Loggers>

      </Configuration>

      Attachments

        1. log4j2.xml
          0.9 kB
          houssem mzoughi

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hmzoughi houssem mzoughi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: