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

TimeBasedRollingPolicy writes into 2 different log files

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • None
    • 1.1.3
    • None
    • None

    Description

      Hi,
      This is my very first ticket I open so please forgive me if i'm doing something wrong.
      I've noticed that using the following appender:

       <appender name="FILE2"
                    class="ch.qos.logback.core.rolling.RollingFileAppender">
              <encoder>
                  <pattern>${FILE_LOG_PATTERN}</pattern>
              </encoder>
              <file>${LOG_FILE}</file>
              <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                  <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd-HH:mm}.log</fileNamePattern>
              </rollingPolicy>
          </appender>
      

      Logback writes the same lines in 2 different files, in my case i'm rolling the file every minute and here is the output of an ls command:

      -rw-r-----  1 vagrant vagrant  227890 Feb 12 22:24 spring.log.2016-02-12-22:24.log
      -rw-r-----  1 vagrant vagrant  454991 Feb 12 22:25 spring.log.2016-02-12-22:25.log
      -rw-r-----  1 vagrant vagrant  466938 Feb 12 22:26 spring.log.2016-02-12-22:26.log
      -rw-r-----  1 vagrant vagrant  455247 Feb 12 22:27 spring.log.2016-02-12-22:27.log
      drwxrwxrwt  9 root    root        300 Feb 12 22:28 .
      -rw-r-----  1 vagrant vagrant 1729507 Feb 12 22:28 spring.log.2016-02-12-22:20.log
      -rw-r-----  1 vagrant vagrant  101925 Feb 12 22:28 spring.log
      

      as you see the last files written are spring.log and spring.log.2016-02-12-22:20.log, the last 20 says that the file belongs to the 20th minute but the ls command says that the file was written at the 28th minute.

      How to reproduce:
      1. compile the attached project using: mvn clean install
      2. run it on unix as: java -jar boot-demo-0.0.1-SNAPSHOT.jar
      3. in 2 different terminals run: siege http://localhost:8080/log
      4. wait a minute and you will 2 files being written at the same time.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: