How to prevent logging warning?

Vinay Sajip vinay_sajip at yahoo.co.uk
Thu Oct 6 00:28:25 CEST 2005


Thomas Heller wrote:

> I get the behaviour that I want when I add a 'NULL' handler in the
> library, but is this really how logging is intended to be used?
>

The reason for the one-off message is that without it, a
misconfiguration or a failure to configure any handlers is notified to
a user (who is possibly not used to the logging package). I'm not sure
which is more annoying - a one-off message which occurs when no
handlers are configured and yet events are logged, or complete silence
from logging when something is misconfigured, and not giving any
feedback on what's wrong? (It's a rhetorical question - the answer is
of course quite subjective).

Certainly, I could change things so that e.g. the error is suppressed
when logging.raiseExceptions is set to 0 (typically for production
use).

Regards,

Vinay Sajip




More information about the Python-list mailing list