Sometimes when I launch my java application, logback refuses to write anything to my logfile. Sometimes it also refuses to roll the logfile at midnight (or at the first logging event after midnight), which results in logging events being lost to the void. When i look at my main log file when logbacks has failed to roll the log, it will have a time like 23:59, with yesterday's date, and any and all logging statements after that time will be irretrievably lost. I have a fairly simple configuration file, and it looks correct. It certainly should be correct, as it works most of the time.
Here's my configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--See http://logback.qos.ch/manual/appenders.html#RollingFileAppender-->
<!--and http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy-->
<!--for further documentation-->
<append>true</append>
<File>aggregator.log</File>
<encoder>
<!-- was: %d{yyyy-MM-dd HH:mm:ss}%5p [%t] (%F:%L) - %msg%n -->
<pattern>%d{yyyy-MM-dd HH:mm:ss} %-5level [%thread] \(%class{25}:%line\) - %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- By setting the name to .gz here, we get free compression. -->
<fileNamePattern>aggregator.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
</rollingPolicy>
</appender>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %-5level [%thread] \(%class{25}:%line\) - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="file"/>
<appender-ref ref="console"/>
</root>
</configuration>
Unfortunately, I cannot reliably reproduce this error, so debugging it is a bit difficult. Could someone tell me either what I'm doing wrong, or what else might be the problem? If it's of any help, I redirect STDOUT and STDERR to /dev/null (I run on linux, btw).