This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010年07月30日 11:25 by guettli, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (6) | |||
|---|---|---|---|
| msg112063 - (view) | Author: Thomas Guettler (guettli) * | Date: 2010年07月30日 11:25 | |
logging.error('...', exc_info=True) only displays the
frames downward. But I often need the upper frames, to debug a problem.
This example shows, that you don't see the "upper" frame in the stactrace. But that's information is important.
<pre>
import logging
def foo():
try:
raise Exception()
except Exception, exc:
logging.error('Exception occured: %s' % exc, exc_info=True)
def upper():
foo()
upper()
</pre>
<pre>
===> python tmp/t.py
ERROR:root:Exception occured:
Traceback (most recent call last):
File "tmp/t.py", line 6, in foo
raise Exception()
Exception
</pre>
|
|||
| msg112064 - (view) | Author: Thomas Guettler (guettli) * | Date: 2010年07月30日 11:27 | |
Related: #1553375 |
|||
| msg112067 - (view) | Author: Thomas Guettler (guettli) * | Date: 2010年07月30日 11:34 | |
I tested it only on python 2.6. Can someone please look at more reset versions? |
|||
| msg112955 - (view) | Author: Thomas Guettler (guettli) * | Date: 2010年08月05日 08:08 | |
Until exc_info=True prints the current stack, I use this pattern: import traceback logging.error(u's...\nStack: %s' % ( ''.join(traceback.format_stack())), exc_info=True) |
|||
| msg114973 - (view) | Author: Vinay Sajip (vinay.sajip) * (Python committer) | Date: 2010年08月26日 13:31 | |
This also happens on later versions. Since 2.x is essentially frozen, this feature request can't be implemented in 2.x, so recategorising as a Python 3.2 issue. Here, a change in logging will either duplicate code in traceback.py or print the upper frames above the "Traceback (most recent call last):" line, which is not ideal. The best way to implement in logging would be to wait for the implementation of the patch in #1553375, following which a change could be made in Formatter.formatException to invoke traceback.print_exception with the "fullstack" keyword parameter. |
|||
| msg130281 - (view) | Author: Vinay Sajip (vinay.sajip) * (Python committer) | Date: 2011年03月07日 18:46 | |
I'll close this, assuming that the stack_info keyword parameter added to logging calls in 3.2 will be sufficient. I also removed the dependency on 1553375, which would prevent closure. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:04 | admin | set | github: 53673 |
| 2015年06月09日 06:09:15 | piotr.dobrogost | set | nosy:
+ piotr.dobrogost |
| 2011年03月07日 18:46:34 | vinay.sajip | set | status: open -> closed nosy: vinay.sajip, guettli, stutzbach, r.david.murray messages: + msg130281 dependencies: - Add traceback.print_full_exception() resolution: fixed |
| 2011年03月04日 17:41:47 | stutzbach | set | nosy:
+ stutzbach dependencies: + Add traceback.print_full_exception() versions: + Python 3.3, - Python 3.2 |
| 2010年08月26日 13:40:33 | r.david.murray | set | nosy:
+ r.david.murray |
| 2010年08月26日 13:32:00 | vinay.sajip | set | type: enhancement messages: + msg114973 versions: + Python 3.2, - Python 2.6 |
| 2010年08月22日 18:52:49 | vinay.sajip | set | assignee: vinay.sajip nosy: + vinay.sajip |
| 2010年08月05日 08:08:21 | guettli | set | messages: + msg112955 |
| 2010年07月30日 11:34:06 | guettli | set | messages: + msg112067 |
| 2010年07月30日 11:27:20 | guettli | set | messages: + msg112064 |
| 2010年07月30日 11:25:47 | guettli | create | |