-
Notifications
You must be signed in to change notification settings - Fork 173
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
Enable error handlers back #322
Conversation
My fear is that by having two error handlers they could conflict or the errors could be handled twice or handled differently from what would happen without Sentry. What about investigating whether it's possible to attach to the Symfony error handler instead? |
The new end to end tests should keep us safe in regards of double reporting, and in fact I've spotted just one case, fatals, and I've safely ignored them. As for attach points, there are only two and those are not sufficient: a PSR-3 logger and the possibility to attach an exception handler, nothing more. |
Why it's the PSR-3 logger not sufficient? |
Because it's very limited in information, only level & message; no stack trace, for example. |
To me it looks like the exception is passed in the context 🤔 Did you look at how Monolog logs errors in a Symfony application? |
Monolog handler is a completely separate option in this bundle: #247 |
Sure, what I meant was to look at how Monolog was integrated in Symfony out-of-the-box (e.g. when it logs to |
Monolog is PSR-3 compliant, so that interface is surely used as a junction. I can't do that without losing information, as I said. Also, it seems that Symfony simply injects the
|
We discussed this privately, but I'm gonna leave here some notes for future reference: as far as I remember from our conversation, you have at disposal everything you need from the Monolog context (the exception is always present under the Said this, I see a big issue with this change, if I'm not missing something: it looks to me that now all integrations are enabled by default regardless of whether Monolog is used, so either you have to update the README to explain that you manually need to disable the |
Nope, that's not the case. The monolog-sentry integration is NOT enabled by default, as before; and there's already an option to shut off the listeners, useful if you enable the Monolog integration. |
I know that the Monolog integration isn't enabled by default, but as soon as I enable it then those integrations should be disabled without having to do it manually, do you agree? Even if the listener gets disabled, this does not prevent the error handler from being registered as soon as one of those integrations run, so it's better if they don't even get set up |
So you would bind the enabling of the default integrations to the |
Yes, also because not doing this means breaking the compatibility with the current applications that have Monolog enabled: they will suddendly start having one new error handler registered, which could cause issues in the long run |
@ste93cry can I get an approval here? I would like to merge this and use it as a fallback after I implement integrating with Monolog as the first choice as you and Nicolas suggested. |
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 still think that even if this is a fallback it's not the best nor appropriate solution that we should provide, but ok, LGTM
* Reinforce E2E tests with log of sent events * Add failing test for notices * Fix wrong setup in test * Improve E2E tests; add case for fatals * Try to revert the integration disabling to have the full error reporting back * Fix test after last modification * Require --dev symfony/process for client isolation * Do not capture deprecations in E2E tests * Fix CS * Fix PHPStan * Fix last PHPStan error * Remove unneeded alias * Remove unused class * Try to avoid double reporting of fatal errors * Add changelog entry * Fix after-merge issues
While discussing with a colleague, he made me notice that the current setup of the bundle doesn't report everything. Due to the disabled error handler, all
trigger_error
are ignored if they do not raise an exception; so deprecations or notices cannot be collected like this. This was also reported as with #318 by @ruudk.With this PR I'm adding new, improved E2E tests to try and get back the handles, so we can collect all errors, without the old issue of duplicated events (see #156 as an example).
Please, test this out because I'm not 100% sure that my E2E tests are reproducing the real behavior correctly.