Logging

Neil Benn benn at cenix-bioscience.com
Thu Feb 3 05:56:21 EST 2005


Samuel Kilchenmann wrote:

> "<snip>

>
> .>>> logging._handlers.clear()
> .>>> logging.root.handlers = []
> .>>> for l in logging.Logger.manager.loggerDict.values():
> .>>>     l.handlers = []
> after logging.shutdown() and before getting the new logger, your 
> script will probably run without errors.

<snip>
Hello,

          Yeah, I worked that out after a bit, I solved it by keeping a 
record of all the handlers and then calling flush on the handler 
followed by removeHandler from the logger.  It's a bit of a pain but I'd 
prefer to do that rather than go poking around inside the logging 
package but I will put the cleaning up of the dict on a shutdown() call 
as a feature request for logging.

    Thanks for the comm.

Cheers,

Neil

-- 

Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 46
D-01307
Dresden
Germany

Tel : +49 (0)351 4173 154
e-mail : benn at cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com




More information about the Python-list mailing list