do not add error_summary for debug log messages
We catch exceptions and log debug messages a lot, which results in extra occurrences of the exception when we don't need them. Change-Id: I4dd3bf65fb456afc07a8fa7d0c9869bcc266b800 Related-Bug: #1696213 Related-Bug: #1696855 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
34ecde5166
commit
527a76e4e3
|
@ -98,11 +98,16 @@ def _get_error_summary(record):
|
|||
|
||||
If there is no active exception, return the default.
|
||||
|
||||
If the record is being logged at debug level, return an empty
|
||||
string.
|
||||
|
||||
If there is an active exception, format it and return the
|
||||
resulting string.
|
||||
|
||||
"""
|
||||
error_summary = ''
|
||||
if record.levelno == logging.DEBUG:
|
||||
return ''
|
||||
|
||||
if record.exc_info:
|
||||
# Save the exception we were given so we can include the
|
||||
|
|
|
@ -577,7 +577,7 @@ class FluentFormatterTestCase(LogTestBase):
|
|||
try:
|
||||
raise RuntimeError('test_exception')
|
||||
except RuntimeError:
|
||||
self.log.debug('testing', context=local_context)
|
||||
self.log.info('testing', context=local_context)
|
||||
data = jsonutils.loads(self.stream.getvalue())
|
||||
self.assertIn('error_summary', data)
|
||||
self.assertEqual('RuntimeError: test_exception',
|
||||
|
|
Loading…
Reference in New Issue