Controlling exception handling of logging module

Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Oct 19 19:44:54 EDT 2005


sj wrote:
> Thanks, but my point wasn't fixing the bug.  I'd like the logging
> module to raise an exception on this occasion (rather than print and
> consume the error) so that I can find the bug easily.  If those two
> lines were part of 10,000-line code, I'd have to check all logging
> statements one-by-one.

You'll need to subclass your handler and redefine handleError(), which
is called when an exception is raised during a handler's emit()
operation. See

http://www.red-dove.com/logging/public/logging.Handler-class.html#handleError




More information about the Python-list mailing list