Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimedRotatingFileHandler append in local time #311

Open
Frame42 opened this issue May 4, 2020 · 0 comments
Open

TimedRotatingFileHandler append in local time #311

Frame42 opened this issue May 4, 2020 · 0 comments

Comments

@Frame42
Copy link

Frame42 commented May 4, 2020

Hi,

I'm trying to set up a TimeRotationgFileHandler to append to one logfile per hour. It works fine in UTC, but if I set the time to local, the log file is overwritten every time.

import logbook

logbook.set_datetime_format("local")

handler1 = logbook.TimedRotatingFileHandler("service.log", date_format="%Y-%m-%d_%H", mode='a')

handler1.push_application()
logbook.Logger("Logger1").info("First trace")
handler1.pop_application()

handler2 = logbook.TimedRotatingFileHandler("service.log", date_format="%Y-%m-%d_%H", mode='a')
handler2.push_application()

logbook.Logger("Logger2").info("Second trace")
handler2.push_application()

Expected Output

[2020-05-04 09:33:22.386174] INFO: Logger1: First trace
[2020-05-04 09:33:22.387136] INFO: Logger2: Second trace

Current Output
[2020-05-04 09:33:22.387136] INFO: Logger2: Second trace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant