Skip to content

July 19, 2011

Django logging and sentry

Django-sentry has been a fairly useful tool for me. The docs are good but they only talk about integrating with logging the old way.

Here’s how to use Sentry with logging dictionary config:

LOGGING = {
    'version': 1,
    'formatters': {
        'verbose': {
            'format': '%(asctime)s %(levelname)-8s [%(name)s] -- %(message)s'
        },
    },  
    'handlers': {
        //...
        'sentry': {
            'level': 'WARNING',
            'class': 'sentry.client.handlers.SentryHandler',
            'formatter': 'verbose',  
        },
    },
    'loggers': {
        // ...
        'root': {
            'handlers': ['sentry'],
            'level': 'WARNING',
        },
    }
}
Read more from Development

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments