Steve Holden wrote: > Ben Finney wrote: > [...] >> A 'try ... except' statement is not an exception handler. [...] > > Just as a matter of interest, what would your definition of an exception > handler be, then? Specifically, what's the "except" clause for? > > The docs for looging.except should make it explicit that the exception > will be re-raised. > > Of course it might be possible to do something hackish like > > try: > ... > except: > try: > logging.exception(...) > except: > pass > > which (although untested) should theoretically allow the catching (for a > second time) of teh exception reraised by logging.exception().
Use the source, people. The exception is not reraised. The only effect of exception() versus error() is that exception() passes the "exc_info=1" keyword argument to error() which means that the stack trace is added to the logging message. The default logger prints to stdout, which is why the stack trace is printed there too. (In the sense of the logging docs, an except:-clause *IS* an error handler). Georg -- http://mail.python.org/mailman/listinfo/python-list