Created
September 18, 2012 03:58
-
-
Save amitsaha/3741168 to your computer and use it in GitHub Desktop.
purge_handlers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def purge_handlers(): | |
| #shutdown logging subsystem | |
| #Called during application exit or reinitialization, hence OK. | |
| logging.shutdown() | |
| #remove all handlers | |
| for (_, logger) in logging.root.manager.loggerDict.items(): | |
| if hasattr(logger, 'handlers'): | |
| for handler in logger.handlers: | |
| logger.removeHandler(handler) | |
| #clear out logging's internal handler list | |
| logging._handlerList = [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment