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

Allow leading zeros in %i pattern

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.7
    • Fix Version/s: 1.3.0-alpha0
    • Component/s: logback-core
    • Labels:
      None

      Description

      I use the appender like

      <appender name="ROLL-INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
          <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${IR}/vcs-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
            <maxFileSize>15MB</maxFileSize>
            <maxHistory>100</maxHistory>
          </rollingPolicy>
          <encoder>
            <pattern>${log-format}</pattern>
          </encoder>
        </appender>
      

      the pattern I specify includes file counter in each day. In may case it may easily turn out I have hundreds of files per day.

      The problem is that %i syntax does not allow me to have leading zeroes in the names I generates. This ends up it's a but tricky to look through files list I have on my disk, which are sorted in sexicographical order.

      Having an ability to force adding leading zeroes to the pattern will solve the issue.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ceki Ceki Gülcü
              Reporter:
              jonnyzzz Eugene Petrenko
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: