Skip to content

Clarification on Time-Based Rollover Without Log Events in Logback #947

@Dushyant-GitHub

Description

@Dushyant-GitHub

Hi Team,

We are using Logback with a TimeBasedRollingPolicy configured to roll logs on a monthly basis. We've noticed that the rollover to a new log file does not occur automatically when the new month starts -- it only happens after a new log entry is written. This behavior appears consistent even if the configured rollover time (e.g., the 1st of the month) has already passed.

We would like to confirm:

  1. Is it expected behavior that Logback only performs time-based rollover when a log event is triggered?

  2. If so, is there a recommended way to proactively trigger or force a rollover at the time boundary?

  3. Are there any APIs or hooks we can use to check the rollover condition and initiate it manually without writing a log event?

Any guidance or best practices on how to handle this scenario would be greatly appreciated, especially in systems where logging may be quiet for long periods but we still want timely log archival.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions