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

RollingFileAppender does not auto create subdirectories in some circumstances

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 0.9.17
    • logback-classic
    • None

    Description

      If the FileNamePattern of the rollingPolicy contains another directory than the File element of the appender, than the directory in the FileNamePattern is not created automatically.

      The OnConsoleErrorListener writes out the following error in this case:
      -ERROR in c.q.l.core.rolling.helper.Compress - Error occurred while compressing [/opt/baa-logserver/logs/logback.log33794048136194907.tmp] into [/opt/baa-logserver/logs/archive/logback_2009-10-26.log.zip]. java.io.FileNotFoundException: /opt/baa-logserver/logs/archive/logback_2009-10-26.log.zip (No such file or directory)
      at java.io.FileNotFoundException: /opt/baa-logserver/logs/archive/logback_2009-10-26.log.zip (No such file or directory)

      The appender is configured as followed (files are rolled into a archive directory on daily basis):

      <appender name="LOGBACK" class="ch.qos.logback.core.rolling.RollingFileAppender">
      <File>${LOG_DIR}/logback.log</File>
      <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <FileNamePattern>${LOG_DIR}/archive/logback_%d

      {yyyy-MM-dd}

      .log.zip</FileNamePattern>
      <MaxHistory>${MAX_HISTORY_DAYS}</MaxHistory>
      </rollingPolicy>

      <layout class="ch.qos.logback.classic.PatternLayout">
      <Pattern>%date

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

      [%contextName] (%mdc

      {refId}

      ) %-5level %logger

      {0}

      - %msg%n%xEx

      {full}

      </Pattern>
      </layout>
      </appender>

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            rick Rick Janda
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: