WatchedFileHandler.reopenIfNeeded() usage - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: WatchedFileHandler.reopenIfNeeded() usage (/thread-13970.html) |
WatchedFileHandler.reopenIfNeeded() usage - buntu - Nov-09-2018 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/logging.handlers.html#logging.handlers.WatchedFileHandler.reopenIfNeeded I tried this but seems to fail with errors: handler = logging.handlers.WatchedFileHandler(somefile) handler.setFormatter(formatter) handler.reopenIfNeeded()Thanks! RE: WatchedFileHandler.reopenIfNeeded() usage - micseydel - Nov-09-2018 (Nov-09-2018, 02:56 AM)buntu Wrote: but seems to fail with errorsWhat errors, exactly? RE: WatchedFileHandler.reopenIfNeeded() usage - buntu - Nov-09-2018 Actually typo in my code, sorry about that. |