Skip to content

Missed rollover during application down #1070

Closed

Description

@ceki

Discussed in #1032

Originally posted by mstaudt April 14, 2026
Hi all, I have the following appender setup in my application that performs hourly rollover and compresses log files:

<appender name="log-file" class="ch.qos.logback.core.rolling.RollingFileAppender">
  ..
  <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <fileNamePattern>log.json.%d{yyyy-MM-dd-HH}.gz</fileNamePattern>
    <maxHistory>36</maxHistory>
    <totalSizeCap>1GB</totalSizeCap>
  </rollingPolicy>
</appender>

which produces files like these:

log.json.2026-04-14-08.gz
log.json.2026-04-14-09.gz
log.json.2026-04-14-10      <-- currently active file

this is working great except for the following scenario:

  • Let's say the application is down (i.e. due to a deployment) from 10:58 to 11:02
  • The rollover of the log.json.2026-04-14-10 file does not happen, so it's not getting compressed to .gz
  • During next archive removal execution, this file is also not touched as it doesn't match the .gz file extension
  • This leads to orphan files that slowly eat up disk space without any built-in removal from logback

Using cleanHistoryOnStart also doesn't help, as this only checks for .gz files as specified in the fileNamePattern.

I'm looking for advice on how to handle these cases, as I imagine this could be a thing affecting other applications as well. Thanks!

Activity

  1. ceki commented on Oct 2, 2026

    @ceki
    MemberAuthor

    Fixed in release version 1.6.5

  2. self-assigned this
    on Oct 2, 2026
  3. added this to the 1.6.5 milestone on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions