Looks like this is related to the logging.exception doesn't accept 'extra' bug (which was fixed in the 2.7 and 3.2 branches).
As a workaround, use logging.error()
passing exc_info=True
argument.
FYI, logging.exception()
actually does call logging.error()
under the hood, quote from cpython 2.7 source:
def exception(self, msg, *args, **kwargs):
"""
Convenience method for logging an ERROR with exception information.
"""
kwargs['exc_info'] = True
self.error(msg, *args, **kwargs)
See also:
- Python: Logging exceptions with custom *kwargs
- python-logstash-formatter (there is an example of including traceback exception into json log formatter)