Issue Type: Improvement Improvement
Affects Versions: 1.0.13
Assignee: Logback dev list
Components: logback-classic
Created: 18/Mar/14 9:54 PM
Description:

I ran into exactly this http://tonaconsulting.com/error-in-ch-qos-logback-core-joran-spi-interpreter2325-runtimeexception-in-action-for-tag-rollingpolicy-java-lang-indexoutofboundsexception-no-group-1/ (apparently someone else too) and believe that it could be detected when reading the configuration. I would prefer getting an invalid configuration exception at startup compared to the current runtime exception that only occurs rarely.

Example wrong config:
<fileNamePattern>var/log/mylog.log.%d

{yyyy-MM}.zip</fileNamePattern>

Correct config needs counter variable:
<fileNamePattern>var/log/mylog.log.%d{yyyy-MM}

(%i).zip</fileNamePattern>

The exception I received was
java.lang.IndexOutOfBoundsException: No group 1

Full config example:

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>var/log/myfile.log</file>
<encoder>
<pattern>%d

{yyyy-MM-dd/HH:mm:ss.SSS/zzz}

[%t] %-5p %m%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>var/log/myfile.%d

{yyyy-MM}

(%i).log.zip</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>3</maxHistory>
</rollingPolicy>
</appender>

Environment:

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

Project: logback
Priority: Trivial Trivial
Reporter: Fabian Kessler
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
logback-dev mailing list
logback-dev@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-dev

Reply via email to