[Flask] Flask + uwsgi + TimedRotatingFileHandler = hilarity
Skip Montanaro
skip.montanaro at gmail.com
Fri Jan 12 08:25:49 EST 2018
I'm trying to use the TimedRotatingFileHandler in a Flask+uwsgi app. I
pass "when='midnight'" to the class instantiation:
handler = logging.handlers.TimedRotatingFileHandler("/path/to/logfile.log",
when='midnight')
That starts off okay. When I come in the next morning, I find
/path/to/logfile.log
/path/to/logfile.log-2018-10-11
which, at first glance seems fine. Unfortunately, both files are open
and receiving disjoint subsets of the log messages.
My uwsgi options file contains
processes = 2
logger = python:/path/to/logfile.log
the latter to catch the actual uwsgi log messages. That doesn't seem
to be the culprit though, as I only set that up yesterday, and was
getting the same behavior before. The messages which are distributed
across the files are my application log messages, which leads me to
believe I'm going to need to do something different to set up logfile
rotation.
Any suggestions about how to accomplish this?
Thanks,
Skip Montanaro
More information about the Flask
mailing list