Traceback in Logging

Kottiyath n.kottiyath at
Tue Jan 6 17:17:02 CET 2009

I dont want the whole traceback. I just wanted to know where the log
was generated from i.e. which procedure and which line. I have 3/4
points in many procedures where I encounter a small error (not an
exception) and want to log it. So having individual names for each
looks to be somewhat verbose - esp since the application is >10K LOC.

This might be a good item to have in the logging system - along with
time and level, just proc name and the line number.

Thank you for the help.


Vinay Sajip wrote:
> On Jan 6, 1:33 pm, Kottiyath <n.kottiy... at> wrote:
> > This seems somewhat kludgy. Is it possible in logging mechanism itself
> > to provide traceback as default?
> >
> No, because it's not a common use case to print tracebacks for every
> logging call. There's support for adding traceback information in
> exception handling, via use of the Logger.exception method in the
> exception handling code.
> > I use Python2.4, so LoggingAdapter is not there too.
> If you need LoggingAdapter, you can always copy and paste the relevant
> code from Python's SVN repository into your own application.
> Regards,
> Vinay Sajip

More information about the Python-list mailing list