En Wed, 17 Mar 2010 09:42:06 -0300, Pascal Chambon <chambon.pas...@gmail.com> escribió:
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.
Either I don't understand what you mean, or I can't reproduce it:

<code>
import logging

def a(): return b()
def b(): return c()
def c(): return d()
def d(): raise ValueError

def main():
  logging.basicConfig(level=logging.DEBUG)
  try: a()
  except: logging.exception("An error")

main()
</code>

Output:

D:\temp>python test_logging.py
ERROR:root:An error
Traceback (most recent call last):
  File "test_logging.py", line 10, in main
    try: a()
  File "test_logging.py", line 3, in a
    def a(): return b()
  File "test_logging.py", line 4, in b
    def b(): return c()
  File "test_logging.py", line 5, in c
    def c(): return d()
  File "test_logging.py", line 6, in d
    def d(): raise ValueError
ValueError

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to