为什么我的记录器“sentry.errors”缺少处理程序?

发布于 2024-12-07 02:45:08 字数 576 浏览 1 评论 0原文

我以集成方式安装了 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”是我无法登录哨兵的根本原因。我走在正确的轨道上吗?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情场扛把子 2024-12-14 02:45:08

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

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

此外,请参阅有关似乎添加哨兵的旧版本的文档。手动错误日志处理程序:

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

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

謌踐踏愛綪 2024-12-14 02:45:08

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

RAVEN_CONFIG = {
    'dsn': 'threaded+requests+https://[email protected]/1',
}

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',
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文