Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get a missing handler for logger "sentry.errors"?

Tags:

django

sentry

I installed django-sentry in an integrated fashion. I then ran python manage.py shell and tried to log like this:

>> import logging
>> mylog = logging.getLogger('sentrylogger')
>> mylog.handlers
[<logging.StreamHandler instance at 0x9f6130c>,
 <sentry.client.handlers.SentryHandler instance at 0x9ffed4c>]

>> mylog.debug('this is a test 1')
DEBUG 2011-09-28 11:10:33,178 <ipython console> 4607 -1217300800 this is a test 1
No handlers could be found for logger "sentry.errors"

Currently, nothing is written to the sentry. I believe the missing logger 'sentry.errors' is the root cause of my inability to log to sentry. Am I on the right track ?

like image 600
canadadry Avatar asked Sep 28 '11 09:09

canadadry


2 Answers

Yes, there's a handler missing. I cannot explain why logging to one log should affect another log instance, but maybe if you try to write this before doing mylog.debug(..) it will work:

sentry_errors_log = logging.getLogger("sentry.errors")
sentry_errors_log.addHandler(logging.StreamHandler())

Furthermore, refer to the documentation about older versions that seem to add sentry.errors log handler manually:

http://readthedocs.org/docs/sentry/en/latest/config/index.html#older-versions

like image 79
benjaoming Avatar answered Sep 27 '22 20:09

benjaoming


if you are running sentry on your own domain with HTTPS, there is a bug in sentry SNI support. check https://github.com/getsentry/raven-python/issues/523 for more details. A quick workaround is to replace DSN scheme by threaded+requests+https:

RAVEN_CONFIG = {
    'dsn': 'threaded+requests+https://[email protected]/1',
}
like image 20
Ali Avatar answered Sep 27 '22 21:09

Ali