gpt4 book ai didi

php - Symfony 上的 Sentry : how to exclude `NotFoundHttpException`

转载 作者:行者123 更新时间:2023-12-05 03:49:08 26 4
gpt4 key购买 nike

我正在使用 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 中。

我做错了什么?

最佳答案

对于最新版本的 Sentry 和 Sentry 包(版本 4),您需要为 Sentry\Integration\IgnoreErrorsIntegration 服务创建一个条目。

使用以下内容更新您的 services.yaml:

services:

<...other services>

Sentry\Integration\IgnoreErrorsIntegration:
arguments:
$options:
ignore_exceptions:
- Symfony\Component\HttpKernel\Exception\NotFoundHttpException

之后要告诉 Sentry 使用此集成,您需要更新 sentry.yaml 文件以包含 IgnoreErrorsIntegration:

sentry:
dsn: '%env(SENTRY_DSN)%'
options:
integrations:
- 'Sentry\Integration\IgnoreErrorsIntegration'

来源:changelog of the 4.x branch

关于php - Symfony 上的 Sentry : how to exclude `NotFoundHttpException` ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64098722/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com