[Tutor] Exceptions: Logging TB and local variables?
kent37 at tds.net
Wed Oct 10 14:22:47 CEST 2007
Allen Fowler wrote:
> In the error log, I would like to record a stacktrace and various local
> variables that existed in subX at the time the Exception was thrown...
The stack trace is easy - add the parameter exc_info=True to the logging
When you to this the traceback is included in the log message.
For the local variables, you have to do some work yourself. You might
look at IPython, it has an option to show local variables in the
post-mortem stack traces, maybe you could take some code from there. See
the ultraTB module.
More information about the Tutor