Search code examples
javaloggingjettylogback

Jetty access logs writing to a .tmp file


Problem I am observing:

At random times of the day, logs start going to .tmp files access.log6732547707051856.tmp (which has logs from 00:00:00 to 00:00:01, this is acceptable I guess when the rollover is happening) and access.log6844458502795078.tmp are two of the files which have logs.

The logger continues to log into the newest tmp file. I have observed a case where it starts writing to the .tmp file at about 6 AM and continues to write there. This stops at the next roll i.e. at 00:00:00 (midnight) where the access.log file is compressed. The .tmp files still remain after this.

  1. Why don't the temp files go away?
  2. Why does it write to the temp files at times when the rollover isn't supposed to happen?

Details of system:

Jetty version I am using: 8.1.15

I am instantiating a new RequestLogHandler with

RequestLogImpl requestLog = new RequestLogImpl();
requestLog.setFileName("logback-access.xml");
requestLogHandler.setRequestLog(requestLog);

The logback-access.xml has

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>/var/log/service/package/access-%d{yyyy-MM-dd}.log.gz</fileNamePattern>
        <maxHistory>10</maxHistory>
    </rollingPolicy>

Solution

  • This is an open bug with the logback implementation, usually seen when rolling is combined with its gzip / compression layer.