【发布时间】:2021-01-13 19:58:10
【问题描述】:
我正在使用 SentryBundle 将 Sentry 集成到我的 Symfony 应用程序中。
我不想记录“NotFoundExceptions”,所以我这样配置捆绑包:
sentry:
dsn: '%env(SENTRY_DSN)%'
register_error_listener: false # Disables the ErrorListener
monolog:
error_handler:
enabled: true
level: error
messenger:
enabled: true # flushes Sentry messages at the end of each message handling
capture_soft_fails: true # captures exceptions marked for retry too
options:
environment: '%kernel.environment%'
# release: '%env(VERSION)%' #your app version
excluded_exceptions:
- Symfony\Component\HttpKernel\Exception\NotFoundHttpException
不幸的是,这似乎还不够,因为异常继续记录在 Sentry 中。
我做错了什么?
【问题讨论】:
-
你是否按照doc 中的说明在独白配置中设置了哨兵处理程序?您也可以在那里排除特定的 http 错误代码:
excluded_http_codes: [403, 404, { 400: ['^/foo', '^/bar'] }] -
是的,深入分析 Sentry 中的日志,我注意到了这一点,我怀疑它是由 Monolog 记录的。奇怪的是,在 Monolog 中我已经排除了 404 错误...我再看一下:谢谢!
-
您好,您找到其他解决方案了吗?
-
我没有进一步调查这个...我会在接下来的几天里做...我会试试这个:```独白:处理程序:哨兵:类型:服务ID:哨兵\ Monolog\Handler exclude_http_codes: [404, 405] ```
-
对不起格式错误... 基本上我会在 Monolog config 的 Sentry 配置中直接添加键
exclude_http_codes。
标签: php symfony logging sentry