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

Log files are not rotating if directory name and file name both have date pattern.

    XMLWordPrintable

Details

    Description

      Log files don't rotate if fileNamePattern contains directory name and file name with date pattern.

      <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">

      <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">

      <Pattern>%level %date [%thread] [%file:%line] %msg%n</Pattern>

      </encoder>

      <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">

      <fileNamePattern>/data/logs/api/app/%d{yyyy-MM-dd}/api.%d{yyyy-MM-dd-HH-mm}.log</fileNamePattern>

      <maxHistory>240</maxHistory>

      </rollingPolicy>

      </appender>

       

      It starts working fine , if date formatted directory is removed from fileNamePattern.

      <fileNamePattern>/data/logs/api/app/api.%d{yyyy-MM-dd-HH-mm}.log</fileNamePattern>

       

       

       

      Attachments

        Activity

          People

            logback-dev Logback dev list
            atul008 Atul Kumar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: