[Solved]-Logging in Django with raven and sentry

15đź‘Ť

âś…

You have 3 loggers defined: django, raven and sentry.errors. When you call logging.getLogger(__name__) you actually create a “throw-away” one, because your ___name__ doesn’t match any of above.

You should either use the raven logger…

logger = logging.getLogger('raven')
logger.debug('Hola!')

…or setup your own:

LOGGING = {
    # ...
    'loggers': {
        # ...
        'yourapp': {
            'level': 'debug',
            'handlers': ['sentry'],
            'propagate': False,
        },
    }
}

and then in yourapp/views.py:

logger = logging.getLogger(__name__)
logger.debug('Hola!')
👤Alex Morozov

Leave a comment