Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1129

TimeBasedRollingPolicy does not roll files

    XMLWordPrintable

Details

    Description

      Hi,
      In reference to this ticket LOGBACK-1128, i wanted to created a small test case as requested.

      I'm using the follwing:

       <dependency>
                  <groupId>ch.qos.logback</groupId>
                  <artifactId>logback-classic</artifactId>
                  <version>1.1.3</version>
              </dependency>
      

      and I found another strange behavior. The files are not longer rolled based on my file name pattern:

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration>
      
          <appender name="FILE2"
                    class="ch.qos.logback.core.rolling.RollingFileAppender">
              <encoder>
                  <pattern>%msg</pattern>
              </encoder>
              <file>/tmp/logback.log</file>
              <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                  <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd-HH:mm}.log</fileNamePattern>
              </rollingPolicy>
          </appender>
      
          <root level="INFO">
              <appender-ref ref="FILE2" />
          </root>
      
      </configuration>
      

      How to reproduce:
      0. change the location of the file on logback.xml if necessary
      1. Compile the attached project: mvn clean install
      2. java -jar logback-appender-1.0-SNAPSHOT-jar-with-dependencies.jar
      3. wait 1 minute and you will see that the file is not rolled.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            angel.gavalda@gmail.com Angel Gava
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: