How to prevent logging warning?

Vinay Sajip vinay_sajip at yahoo.co.uk
Thu Oct 6 19:31:05 CEST 2005


Thomas Heller wrote:

> I do *not* think 'no handler' is a misconfiguration. Is it possible to
> differentiate between a misconfiguration and 'no configuration'?

It's a fair point. The line was more blurred when the logging package
was newly released into the wild ;-) But "no configuration" could be
caused e.g. by an unreadable config file, which might also be
categorised as a "misconfiguration".

> That would be fine.  But there are also other ways - you could, for
> example, print the warning only when __debug__ is False.  And you could
> use the warnings module instead of blindly printing to stderr, this way
> it could also be filtered out.

Compatibility with 1.5.2 precludes use of the warnings module. If using
raiseExceptions meets your requirement, I'll use that. I'm not sure
it's a good idea for the behaviour to change between running with and
without -O.

> BTW: Since I have your attention now, is the graphical utility to
> configure the logging.conf file still available somewhere, and
> compatible with the current logging package (with 'current' I mean
> the one included with Python 2.3.5)?

You can always get my attention via email :-) The graphical utility
(logconf.py) is available from the download at

http://www.red-dove.com/python_logging.html#download

AFAIK it should work OK with 2.3.5, though I haven't tested it recently
as there wasn't much interest in it. In fact you're the first person to
ask! It generates a few extra entries in the config file which are used
by the utility only, which are seemingly regarded as "cruft" by most
people.

Regards,


Vinay Sajip




More information about the Python-list mailing list