warnings.warn vs logging.warning

Gunter Henriksen gunterhenriksen at gmail.com
Wed Aug 19 17:43:55 CEST 2009


When I want to issue a warning, I am uncertain
about the distinction between warnings.warn() and
logging.warning().  My naive thought is to presume
"warning" means the same thing in both cases, and
so if I call logging.warning(), it should take
care of making sure something equivalent to my
calling warnings.warn() will happen... more than
just having a message go to wherever a message
to warnings.warn() would go.  If I want to utilize
the capabilities of both mechanisms (like having
an exception raised), should I call both functions?



More information about the Python-list mailing list