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

Reload of RolloverStrategy doesn't work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • 2.5
    • None
    • None

    Description

      I am using this configuration :

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration status="DEBUG" monitorInterval="2">
        <Appenders>
          <RollingFile name="RollingFile" fileName="/tmp/test/app.log" filePattern="/tmp/test/app.log.%i">
            <PatternLayout>
              <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
            </PatternLayout>
            <Policies>
              <SizeBasedTriggeringPolicy size="100KB"/>
            </Policies>
            <DefaultRolloverStrategy max="5"/>
          </RollingFile>
        </Appenders>
        <Loggers>
          <Root level="info" includeLocation="false">
            <AppenderRef ref="RollingFile"/>
          </Root>
        </Loggers>
      </Configuration>

      I am changing the DefaultRolloverStrategy "max" attribute from 5 to 10.
      I can see the reloading take place from the StatusLogger (full log attached):

      DEBUG Starting configuration XmlConfiguration[location=/usr/local/apps/log4j2-test.xml]
      (...)
      DEBUG Found factory method [createStrategy]: public static org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy.createStrategy(java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.apache.logging.log4j.core.config.Configuration).
      2015-07-24 12:08:00,938 DEBUG Calling createStrategy on class org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy for element DefaultRolloverStrategy with params(name="10", name="null", name="null", name="null", Configuration(/usr/local/apps/log4j2-test.xml))

      So log4j2 is seeing the changes, but there is still only 5 files produced 1->5.

      (I made sure that I was producing enough log data)

      If I change the message pattern, I see it change in the log file, but not the RolloverStrategy parameters.

      Attachments

        1. reload.txt
          12 kB
          Benjamin Jaton

        Issue Links

          Activity

            People

              rgoers Ralph Goers
              benjamin.jaton Benjamin Jaton
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: