Hello, <br><br>traceback functions indeed allow the manipulation of exception tracebacks, but the root problem is that anyway, since that traceback is incomplete, your "traceback.format_exc().splitlines()" will only provide frames for callee (downward) functions, not caller (upward) ones, starting from the exception catching frame.<br>
<br>Regards, <br>Pascal<br><div> <br></div><br><br><div class="gmail_quote">2010/3/17 Michael Ricordeau <span dir="ltr"><<a href="mailto:michael.ricordeau@gmail.com">michael.ricordeau@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
to log tracebacks, you can probably try traceback module.<br>
<br>
I use it like this :<br>
<br>
import traceback<br>
.... # your code<br>
<br>
for line in traceback.format_exc().splitlines():<br>
log.trace(line)<br>
<br>
<br>
<br>
Le Wed, 17 Mar 2010 03:42:44 -0700 (PDT),<br>
Pakal <<a href="mailto:chambon.pascal@gmail.com">chambon.pascal@gmail.com</a>> a écrit :<br>
<div><div></div><div class="h5"><br>
> Hello<br>
><br>
> I've just realized recently that sys.exc_info() didn't return a full<br>
> traceback for exception concerned : it actually only contains the<br>
> frame below the point of exception catching.<br>
><br>
> That's very annoying to me, because I planned to log such tracebacks<br>
> with logging.critical(*****, exc_info=True), and these partial<br>
> tracebacks, like the one below, are clearly unsufficient to determine<br>
> where the problem comes from. A whole traceback, from program entry<br>
> point to exception raising point, would be much better.<br>
><br>
> 2010-03-17 09:28:59,184 - pims - CRITICAL - This is just a test to<br>
> ensure critical emails are properly sent<br>
> Traceback (most recent call last):<br>
> << HERE, lots of frames missing >><br>
> File "test_common.py", line 34, in test_email_sending<br>
> os.open("qsdsdqsdsdqsd", "r")<br>
> TypeError: an integer is required<br>
><br>
> Is there any workaround for this ? I've thought about a custom logging<br>
> formatter, which would take both the exc_info traceback AND its own<br>
> full backtrace, and to connect them together on their relevant part,<br>
> but it's awkward and error prone... why can't we just have all the<br>
> precious traceback info under the hand there (an additional attribute<br>
> might have pointed the precise frame in which the exception was<br>
> caught).<br>
><br>
> Tanks for the attention,<br>
> Regards,<br>
> Pascal<br>
</div></div></blockquote></div><br>