Aer*_*dir 3 php logging symfony sentry
我正在使用 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
Run Code Online (Sandbox Code Playgroud)
不幸的是,这似乎还不够,因为异常继续记录在 Sentry 中。
我究竟做错了什么?
对于最新版本的 Sentry 和 Sentry 捆绑包(版本 4),您需要为该Sentry\Integration\IgnoreErrorsIntegration
服务创建一个条目。
更新你services.yaml
的:
services:
<...other services>
Sentry\Integration\IgnoreErrorsIntegration:
arguments:
$options:
ignore_exceptions:
- Symfony\Component\HttpKernel\Exception\NotFoundHttpException
Run Code Online (Sandbox Code Playgroud)
之后,要告诉 Sentry 使用此集成,您需要更新sentry.yaml
文件以包含IgnoreErrorsIntegration
:
sentry:
dsn: '%env(SENTRY_DSN)%'
options:
integrations:
- 'Sentry\Integration\IgnoreErrorsIntegration'
Run Code Online (Sandbox Code Playgroud)
来源:4.x 分支的变更日志
归档时间: |
|
查看次数: |
3783 次 |
最近记录: |