Sentry can detect additional data associated with an exception such as:
How do you raise such an exception from Python (it's a Django app) with your own additional data
fields?.
I log exceptions using the logging
library so after debugging the code a bit, I noticed the extra
parameter:
import logging
logger = logging.getLogger('my_app_name')
def do_something():
try:
#do some stuff here that might break
except Exception, e:
logger.error(e, exc_info=1, extra={'extra-data': 'blah', })
Passing exc_info=1 is the same as calling logger.exception
. However, exception()
does not accept kwargs, which are required for using the extra
parameter.
These values will show up in the 'Additional Data' section of the Sentry Error dashboard.