Details
-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
0.9.17
-
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
.log.zip</FileNamePattern>
<MaxHistory>${MAX_HISTORY_DAYS}</MaxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%date
[%contextName] (%mdc
{refId}) %-5level %logger
{0}- %msg%n%xEx
{full}</Pattern>
</layout>
</appender>