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

Logback not correctly parsing IntegerToken with given fileNameFormat

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • None
    • 1.0.13
    • logback-core
    • None

    Description

      I am configuring logback programmatically with a FixedWindowRollingPolicy. I am trying to set the fileNamePattern with something like

      FixedWindowRollingPolicy rolling = new FixedWindowRollingPolicy();
      			rolling.setParent(appender);
      			rolling.setMaxIndex(1);
      			rolling.setMaxIndex(5);
      			rolling.setFileNamePattern(file + ".%i.zip");
      			rolling.start();
      

      but I always get the following exception

      Exception in thread "main" java.lang.ExceptionInInitializerError
      	at org.cinchapi.concourse.server.ConcourseServer.<clinit>(ConcourseServer.java:162)
      Caused by: java.lang.IllegalStateException: FileNamePattern [log/performance.log.%1zip] does not contain a valid IntegerToken
      	at ch.qos.logback.core.rolling.FixedWindowRollingPolicy.start(FixedWindowRollingPolicy.java:93)
      	at org.cinchapi.concourse.server.util.Loggers.getLogger(Loggers.java:90)
      	at org.cinchapi.concourse.server.util.Loggers.<clinit>(Loggers.java:120)
      	... 1 more
      

      The same behaviour happens even if I give it an explicit string (without a variable filename). It seems that the '%i' is not being parsed correctly...

      Attachments

        Activity

          People

            logback-dev Logback dev list
            jtnelson1 Jeff Nelson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: