为什么我为记录器“sentry.errors”找到了丢失的处理程序?

时间:2011-09-28 09:16:24

标签: django sentry

我以综合方式安装了django-sentry。 然后我运行python manage.py shell并试图像这样记录:

>> 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"

目前,没有任何东西写入哨兵。我相信丢失的记录器'sentry.errors'是我无法登录哨兵的根本原因。我是在正确的轨道上吗?

2 个答案:

答案 0 :(得分:2)

是的,缺少一个处理程序。我无法解释为什么登录到一个日志会影响另​​一个日志实例,但是如果你在执行mylog.debug(..)之前尝试编写它,它可以工作:

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

此外,请参阅有关旧版本的文档,这些文档似乎手动添加了sentry.errors日志处理程序:

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

答案 1 :(得分:0)

如果您正在使用HTTPS在自己的域上运行哨兵,则哨兵SNI支持中存在错误。查看https://github.com/getsentry/raven-python/issues/523了解更多详情。一种快速的解决方法是用threaded+requests+https代替DSN方案:

RAVEN_CONFIG = {
    'dsn': 'threaded+requests+https://xxxxxxxxxxxx@sentry.example.com/1',
}