Skip to content

TimeRotatingFileHandler doesn't work as expected #139484

@Ixiodor

Description

@Ixiodor

Bug report

Bug description:

Referencing #111054, I found the same issue.
Original post:

Here we go!
I ran into the same issue: the rotation is set to daily, but the logger keeps writing multiple days into the same log file.
args = args = ('logs/logs.log', "D", 1, 7, 'utf-8')

Started:

29-09-2025 16:29:16 | INFO | configuration(root) | Loaded config file: config/config.ini

Still going:

01-10-2025 12:21:23 | INFO | REDACTED

I have some files with GIGA of logs from multiple days.

EDIT:
Seems like each time the application restart for some reason, the "internal day" restars, that means:
Started 29/09 01:00 -> crash at 29/09 13:00, the new rotation is 30/09 13:00 -> crash at 30/09 17:00, the new rotation is 01/09 17:00. On same file, keep going till a full day.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions