Python Forum

Full Version: WatchedFileHandler.reopenIfNeeded() usage
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi -- I'm trying to figure out the right way to call WatchedFileHandler.reopenIfNeeded() to help reopen a new file if the file was rotated by logrotate:
https://docs.python.org/3/library/loggin...enIfNeeded

I tried this but seems to fail with errors:

handler = logging.handlers.WatchedFileHandler(somefile)
handler.setFormatter(formatter)
handler.reopenIfNeeded()
Thanks!
(Nov-09-2018, 02:56 AM)buntu Wrote: [ -> ]but seems to fail with errors
What errors, exactly?
Actually typo in my code, sorry about that.