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

Dynamic reconfiguration does not work for filePattern of RollingFile

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.8.2
    • 2.9.0
    • Core
    • None
    • JDK 1.7.80

    Description

      The initial log4j2.xml file was

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration status="INFO" monitorInterval="60">
          <Properties>
              <Property name="LOG_HOME">./logs</Property>
          </Properties>
      
          <Appenders>
              <RollingFile
                  name="RollingFileAppender"
                  fileName="${LOG_HOME}/log.log"
                  filePattern="${LOG_HOME}/log.log.%d{yyyy-MM-dd}.%i">
                  <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
                  <PatternLayout pattern="%d{DEFAULT} %p %t %c %L: %m%n"/>
                  <Policies>
                      <OnStartupTriggeringPolicy/>
                      <!--<TimeBasedTriggeringPolicy/>-->
                      <SizeBasedTriggeringPolicy size="256MB"/>
                  </Policies>
                  <DefaultRolloverStrategy max="8"/>
              </RollingFile>
          </Appenders>
      
          <Loggers>
              <Root level="INFO">
                  <AppenderRef ref="RollingFileAppender"/>
              </Root>
          </Loggers>
      </Configuration>
      

      And then I changed filePattern to

      filePattern="${LOG_HOME}/log.log.%i"
      

      Log file names still contain date.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              in-chief Xiaoshuang LU
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: