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

Please consider width options for %i filename part in TimeBasedRollingPolicy (or other places)

    XMLWordPrintable

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • None
    • None

    Description

      I would like to make logback create TimeBasedRollingPolicy file names that use leading 0s for %i. Here's an excerpt from the logback.xml file

      <rollingPolicy class="ch.quos.logback.core.rolling.TimeBasedRollingPolicy">
      <fileNamePattern>logs/foo_%d

      {yyyyMMdd}

      -%i.log</fileNamePattern>
      ...
      </rollingPolicy>

      The created filenames will be foo_20130501-0.log, foo_20130501-1.log, ... foo_20130501-9.log, foo_20130501-10.log, ...

      Instead, I would like the files named like this: foo_20130501-000.log, foo_20130501-001.log, ... foo_20130501-009.log, foo_20130501-010.log, ...

      I'm using 3 digits width as an example (my use cases are actually 2 and 4 digits). The implemented feature should be able to handle any positively number width, and deal with overflows.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            daniel daniel
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: