Re: Logging

From: Neil Benn (benn_at_cenix-bioscience.com)
Date: 02/03/05


Date: Thu, 03 Feb 2005 11:56:21 +0100

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@cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com


Relevant Pages

  • Logging with no handlers configured
    ... logger or its parents and you try to log events with that logger, ... No handlers could be found for logger ... logging or configure any handlers, the spurious message should not be ... the logging system will not give any notification. ...
    (comp.lang.python)
  • Re: Logging
    ... "Neil Benn" schrieb im Newsbeitrag ... >> logging.shutdown() and then want to start the logging going again ... logging.shutdowndoesn't clean up the dict of handlers at the module ... the closed filehandle. ...
    (comp.lang.python)
  • Re: Logging: how to suppress default output when adding handlers?
    ... But if any of my code calls a logger ... thelogging ... or remove it when I 'm setting up my handlers? ... Configure the logging system yourself before any logging call is ...
    (comp.lang.python)
  • Thanks
    ... Thanks for you assistance. ... The problem was the the logger didn't have ... any handlers. ... to do logging: ...
    (comp.lang.java.programmer)
  • "No handlers could be found for logger xxx" ?
    ... "No handlers could be found for logger xxx" on stderr ... I don't want to deal with this logging at all so far - its useless in this case anyway. ...
    (comp.lang.python)