[Python-Dev] Using logging in the stdlib and its unit tests
vinay_sajip at yahoo.co.uk
Wed Dec 8 13:22:07 CET 2010
Antoine Pitrou <solipsis <at> pitrou.net> writes:
> On Wed, 08 Dec 2010 11:48:16 +0100
> Georg Brandl <g.brandl <at> gmx.net> wrote:
But hopefully standard
> > library modules don't use it to report exceptions to code that uses them?
> I'm not aware of that, but there are certainly third-party libs using
> it (think an HTTP server that wants to log an error in one of its
> request handlers without the error taking the whole server down).
That's not the same thing as Georg is talking about, IIUC. The exception()
method is used in exception *handler* code to record that the exception
occurred, but the correct thing for any code to do when an error condition is
detected (in most situations at least) is to raise an exception. It would be
quite wrong for code to e.g. call logger.error(...) instead of raise ...
More information about the Python-Dev