gpt4 book ai didi

php - 如何从 Symfony 中的 Sentry 中排除异常?

转载 作者:行者123 更新时间:2023-12-04 14:33:54 32 4
gpt4 key购买 nike

我安装了 Symfony 4.3 并将其升级到 4.4.19。
在我的旧安装中,Sentry 与 exclude_exception 运行良好。
我在 sentry.yaml 上是这样用的:

sentry:
dsn: "https://key@sentry.io/id"
options:
excluded_exceptions:
- App\Exception\BadArgumentException
- App\Exception\BadFilterException
- App\Exception\BadRequestException
但是当我升级到 4.4.19 时,symfony 日志告诉我 excluded_exceptions不存在。
Sentry 在我的项目中获取每个异常。它运行良好,所以我不明白为什么它不能识别此选项。 (我已经看到它被添加到 v2.1 的哨兵中)。
我试过做一个 composer update sentry/sentry-symfony但没有任何变化。
在我的 composer.json 我在需要部分有这个: "sentry/sentry": "^3.1", "sentry/sentry-symfony": "^4.0",所以我不知道现在该怎么做才能解决这个问题。也许我必须忘记一些事情。

最佳答案

请查收 upgrade file适用于 Sentry Symfony 4.0。
根据这个文件sentry.options.excluded_exceptions配置选项被删除。
要排除异常(exception),您必须使用 IgnoreErrorsIntegration服务:

sentry:
options:
integrations:
- 'Sentry\Integration\IgnoreErrorsIntegration'

services:
Sentry\Integration\IgnoreErrorsIntegration:
arguments:
$options:
ignore_exceptions:
- App\Exception\BadArgumentException
- App\Exception\BadFilterException
- App\Exception\BadRequestException

关于php - 如何从 Symfony 中的 Sentry 中排除异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66154926/

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