I am trying to use TimedRotatingFileHandler to keep daily logs in separate log files. The rotation works perfectly as intended, but what I don\'t like how it does is the nam
As far as I know there is no way to directly achieve this.
One solution you could try is to override the default behavior.
TimedRotatingFileHandler class
and override the doRollover() function.
/Lib/logging/handlers.py
Something like this:
class MyTimedRotatingFileHandler(TimedRotatingFileHandler):
def __init__(self, **kwargs):
TimedRotatingFileHandler.__init__(self, **kwargs)
def doRollover(self):
# Do your stuff, rename the file as you want