django - 为什么我的记录器 "sentry.errors"缺少处理程序?

标签 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' 是我无法登录到哨兵的根本原因。我在正确的轨道上吗?

最佳答案

是的,缺少一个处理程序。我无法解释为什么记录到一个日志会影响另​​一个日志实例,但也许如果您在执行 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

关于django - 为什么我的记录器 "sentry.errors"缺少处理程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7580934/

相关文章:

django - 'TreeQuerySet' 对象没有属性 'name'

ruby-on-rails - 令人困惑的 Sentry 错误-用户被引导从登录名进行搜索

javascript - 使用 Sentry 时忽略特定的 CSP 错误

python - 如何将异常发送到 django 项目的 Sentry

python - 为不同的环境(登台、生产)配置 Sentry

angular - 防止 Sentry.io 记录服务器错误代码

django - 奇怪的 Django 类型错误 : send_mail() takes at least 4 arguments (4 given)

python - simplexml_load_string 等效于 Python/Django

python - 无法通过查询对象检索值

django - 在Django admin中,如何按组过滤用户?