mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-26 11:49:21 -05:00
logformatter: fix AttributeError
make sure we have the relevant fields before we try to log them.
This commit is contained in:
parent
3cc852d339
commit
f30c4ed2bc
@ -33,9 +33,17 @@ class LogFormatter(logging.Formatter):
|
|||||||
|
|
||||||
def formatException(self, ei):
|
def formatException(self, ei):
|
||||||
sio = StringIO.StringIO()
|
sio = StringIO.StringIO()
|
||||||
|
(typ, val, tb) = ei
|
||||||
|
|
||||||
|
# log the stack above the exception capture point if possible, but
|
||||||
|
# check that we actually have an f_back attribute to work around
|
||||||
|
# https://twistedmatrix.com/trac/ticket/9305
|
||||||
|
|
||||||
|
if tb and hasattr(tb.tb_frame, 'f_back'):
|
||||||
sio.write("Capture point (most recent call last):\n")
|
sio.write("Capture point (most recent call last):\n")
|
||||||
traceback.print_stack(ei[2].tb_frame.f_back, None, sio)
|
traceback.print_stack(tb.tb_frame.f_back, None, sio)
|
||||||
traceback.print_exception(ei[0], ei[1], ei[2], None, sio)
|
|
||||||
|
traceback.print_exception(typ, val, tb, None, sio)
|
||||||
s = sio.getvalue()
|
s = sio.getvalue()
|
||||||
sio.close()
|
sio.close()
|
||||||
if s[-1:] == "\n":
|
if s[-1:] == "\n":
|
||||||
|
Loading…
Reference in New Issue
Block a user