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

Error with simultaneous %d and %i in RollingFileAppender and FixedWindowRollingPolicy

    XMLWordPrintable

Details

    Description

      A Exception is being thrown when configuring a FixedWindowRollingPolicy inside a RollingFileAppender and both %d{} and %i appears in the FileNamePattern.

       

      <appender name="INFO_FILE_APPENDER"
                class="ch.qos.logback.core.rolling.RollingFileAppender">
          <encoder>
              <pattern>%d [%thread] %-5level %logger{36} - %msg%n</pattern>
          </encoder>
          <file>${APP_INFO_LOG_FILE}.log</file>
          <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
              <fileNamePattern>${APP_INFO_LOG_FILE}.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
              <minIndex>1</minIndex>
              <maxIndex>2</maxIndex>
          </rollingPolicy>
          <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
              <maxFileSize>1GB</maxFileSize>
          </triggeringPolicy>
      </appender>
      

       

      The exception:

      [2017-02-27T10:57:04,533+0000][E][SpringApplication][] - Application startup failed
      java.lang.IllegalStateException: Logback configuration error detected:
      ERROR in ch.qos.logback.core.rolling.RollingFileAppender[INFO_FILE_APPENDER] - Appender [INFO_FILE_APPENDER] failed to append. java.lang.IllegalArgumentException: Cannot convert 2 of typejava.lang.Integer
      

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            jagmohansharma Jagmohan Sharma
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: