-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include default configuration for Contao managed edition #12
Conversation
/cc @Shadow-Devil |
I also have
in my |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually only set sentry.dsn
and sentry.options.ignore_exceptions
in my projects. Why do you also set sentry.register_error_listener
, sentry.register_error_handler
and monolog.handlers.sentry
? i.e. what's the purpose/advantage.
Would this be a major version release since all PHP, Contao and Sentry minimum versions were increased? |
Yes. |
Co-authored-by: Fritz Michael Gschwantner <[email protected]>
I was wondering that as well, but that's what the official docs say: https://docs.sentry.io/platforms/php/guides/symfony/#monolog-integration
I know that we do often get error messages twice in our projects (with the same setup you have). I can only assume that's because Monolog integration is logged to sentry as well as the error handler 🤔 |
Hm, I never get error messages twice - I only get multiple sentry entries when there are previous exceptions, which your PR fixes. imho the default config without configuring monolog is enough. |
🤔 symfony/symfony#36472 (comment) I think the reason is that you can only have one error handler in PHP, and if you already have Symfony/Monolog handling the errors, you don't want Sentry to override or interefer with that. symfony/symfony#36472 (comment) Found in getsentry/sentry-symfony#337 |
Ah, I see 👍 |
Another big advantage I just noticed: this now also logs all other monolog errors to Sentry! In my case the CSP violation logged by Contao was added to Sentry 😎 |
Which is something that should be ignored though imho 😁 CSP reports can be quite spammy (as anyone can send anything to the controller). |
well yeah… but Sentry also has specific CSP monitoring, which would make more sense than this. But not really related to this PR 😆 |
@bytehead are you ok with the namespace change or was that "group" intentional? In our bundle, we would actually use |
Personally I would definitely call it |
I would optin for |
I have now used this on several systems in production, and it seems to work fine 🙃 |
Back from holidays, I'll have a look this week! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me apart from the service naming (best practices).
Co-authored-by: David Greminger <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
This PR adds some default configurations if the bundle is included in a Contao Managed Edition. Because most times, the configuration will be identical and repetitive.
I also added an event listener to filter previous exceptions. In my case, I had Twig components throwing an
AccessDeniedException
(which correctly triggers the firewall), which are logged asRuntimeError
even though the previous exception was one to be filtered.The namespace also changed from
Oneup\Contao\SentryBundle
toOneup\ContaoSentryBundle
which I think would be more correct in terms of Composer packages.@fritzmg @richardhj any opinions on this?
TODO: