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

RollingFileAppender/TimeBasedRollingPolicy failing to ZIP files in different directory

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.0.2
    • None
    • logback-core
    • None

    Description

      When using ZIP feature to compress old log files, Logback does not allow to put ZIP files in different directory like in this example:

      <file>logs\server.log</file>
      <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <fileNamePattern>logs\arch\server.%d

      {yyyy-MM-dd_HHmm}.log.zip</fileNamePattern>
      </rollingPolicy>

      Running the attached test maven project (it takes 1 minute to run) will create server.log3560979839057.tmp (or similar) temporary file instead of ZIP file in /arch subdirectory (preferably this directory should be created if not exists). If fileNamePattern in rollingPolicy is changed to: "logs\server.%d{yyyy-MM-dd_HHmm}

      .log.zip" everything works as expected.

      The root of this issue is to be able to automatically ZIP files AND archive them in different directory. It would be great to be able to use date placeholders in folder names, for instance:

      <fileNamePattern>logs\arch-%d

      {yyyy-MM}

      \server.%d

      {yyyy-MM-dd_HHmm}

      .log.zip</fileNamePattern>

      so that Logback would automatically create folders for each month with ZIPped files.

      Attachments

        1. alternative-LBCORE-169.patch
          1 kB
          Mats Henrikson
        2. LBCORE-169_patch.txt
          2 kB
          Paulo R P Andrade

        Activity

          People

            logback-dev Logback dev list
            nurkiewicz Tomasz Nurkiewicz
            Votes:
            10 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: