I can not for the life of me get 500’s in my django app to create events on sentry.
I’m following the new sdk django integration instructions here. I’ve created a view that triggers the divide by zero error. In production I load the url and get a 500 for sure. I have another 500 from a different error of mine I’ve tried as well.
These show up in my logs, but they do not show up in sentry.
When I run the python-based Verifying Your Setup command in the django command line shell:
sentry_sdk.capture_exception(Exception("This is an example of an error message."))
it does show up in sentry. So I know that my settings are importing the correct dsn.
I had thought my issue might be related to this question, but the answer in this question makes not sense to me.
I really want sentry to work, I’ve used it on a client project and I don’t know what the is wrong with it. I’m frustrated with what should be a simple configuration of this tool.
Here is my logging definition from settings.py
:
MIN_LOGGING_LEVEL = 'ERROR'
MIN_DJANGO_LEVEL = 'ERROR'
LOGGING = {
'version': 1,
'disable_existing_loggers': False, # keep Django's default loggers
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
'timestampthread': {
'format': "%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] [%(name)-20.20s] %(message)s",
},
},
'handlers': {
'logfile': {
'level': MIN_LOGGING_LEVEL, # this level or higher goes to the log file
'class': 'logging.handlers.RotatingFileHandler',
'filename': LOG_FILE_PATH,
'maxBytes': 100 * 10 ** 6, # will 50 MB do?
'backupCount': 3, # keep this many extra historical files
'formatter': 'timestampthread'
},
'console': {
'level': MIN_LOGGING_LEVEL, # this level or higher goes to the console
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django': { # configure all of Django's loggers
'handlers': ['logfile', 'console'],
'level': MIN_DJANGO_LEVEL, # this level or higher goes to the console
'propagate': False, # don't propagate further, to avoid duplication
},
# root configuration – for all of our own apps
# (feel free to do separate treatment for e.g. brokenapp vs. sth else)
'': {
'handlers': ['logfile', 'console'],
'level': MIN_LOGGING_LEVEL, # this level or higher goes to the console,
},
},
}