warnings.warn vs logging.warning

Gunter Henriksen gunterhenriksen at gmail.com
Wed Aug 19 11:43:55 EDT 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