[logback-dev] [JIRA] (LOGBACK-1293) Error with simultaneous %d and %i in RollingFileAppender and FixedWindowRollingPolicy

QOS.CH (JIRA) noreply-jira at qos.ch
Wed Apr 5 20:25:01 CEST 2017


Jagmohan Sharma created LOGBACK-1293:
----------------------------------------

             Summary: Error with simultaneous %d and %i in RollingFileAppender and FixedWindowRollingPolicy
                 Key: LOGBACK-1293
                 URL: https://jira.qos.ch/browse/LOGBACK-1293
             Project: logback
          Issue Type: Bug
          Components: logback-core
            Reporter: Jagmohan Sharma
            Assignee: Logback dev list


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

 
{code:java}
<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>/logs/appName.%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>
{code}
 

The exception:
{code:java}
[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
{code}



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list