getsentry / sentry-symfony

The official Symfony SDK for Sentry (sentry.io)
https://sentry.io
MIT License
693 stars 169 forks source link

Sentry and Symfony error handlers conflicts #609

Closed alexander-schranz closed 2 years ago

alexander-schranz commented 2 years ago

Environment

How do you use Sentry? self-hosted/on-premise

sentry/sdk                                 3.1.1 
sentry/sentry                              3.4.0      
sentry/sentry-symfony                      4.2.7 

Steps to Reproduce

Have a symfony project with deprecations:

Run console command which triggers deprecation e.g.:

bin/console cache:clear

Output is normally:

Bildschirmfoto 2022-03-31 um 12 33 41

Install sentry / sentry bundle run again:

bin/console cache:clear
Bildschirmfoto 2022-03-31 um 12 33 22

It looks for me there is some conflicts between symfony error handler (think it handles also deprecations) and the sentry error handler.

In our case we already had disabled the error_listener but it does not have any effects depending on sentry symfony monolog integration:

config/packages/sentry.yaml ```yaml sentry: dsn: "%env(SENTRY_DSN)%" register_error_listener: false # Disable ErrorListener to avoid duplicated events because of monolog handler options: attach_stacktrace: true # Attach stacktrace to monolog events that do not include an exception send_default_pii: true # Include personally identifiable information like user, cookies and headers integrations: - 'Sentry\Integration\IgnoreErrorsIntegration' # monolog configuration for sentry # see also: https://docs.sentry.io/platforms/php/guides/symfony/ monolog: handlers: sentry: type: sentry level: !php/const Monolog\Logger::ERROR hub_id: Sentry\State\HubInterface services: Monolog\Processor\PsrLogMessageProcessor: tags: { name: monolog.processor, handler: sentry } Sentry\Integration\IgnoreErrorsIntegration: arguments: $options: ignore_exceptions: - 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' ```

This issue is maybe related to: https://github.com/getsentry/sentry-symfony/issues/337 and maybe a register_error_handler: false suggested by @Jean85 could fix this issue. But I'm not sure 100% sure it seems to appear only since symfony 5.4/6.0 release and the other issue seems to be older.

Expected Result

Do not output the deprecation notices.

Actual Result

Outputs the deprecation notices.

Jean85 commented 2 years ago

Yes, our error handler and Symfony's interact weirdly, it would be better if we could proceed with #337

github-actions[bot] commented 2 years ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀