-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
dev/mail#72 Remove call to custom fatal error handler from CRM_Core_E… #18017
Conversation
…rror::debug_log_message
(Standard links)
|
@seamuslee001 should we do a full revert? |
@eileenmcnaughton I would say no because the other part of the PR isn't the problem only this part because of https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/Error.php#L962. I would add that looking at the reportError Extension only the part of the patch I am keeping in looks to be needed by it https://lab.civicrm.org/extensions/reporterror |
I agree with the partial revert on its merits. Consider the question: what is https://issues.civicrm.org/jira/browse/CRM-841 IMHO CRM-841 was correct in identifying the problem and the two use-cases, but it was mistaken to conflate the two use-cases into one interface with a singular consumer. It's a mistake because:
The prior patch (#17277) to |
OK - that feels like good analysis - test fails do not relate |
@totten @seamuslee001 The idea of adding fatalErrorHandler into debug_log_message is that it allows it to work with eg. The idea behind it came from the fact that you have no way of knowing what has gone into the log files without actually going and taking a look at them (or using some 3rd-party log parsing tools). With the fatalErrorHandler the idea is that you can use something like reporterror to be notified via email / other methods on any situation that might need the attention of a sysadmin. Agree with reverting for 5.27/5.28 but do we have an idea of how we might resolve this properly in master while still having the "one place to capture all errors" functionality? The first step is almost certainly to remove the fatalErrorHandler from JobManager and replace with temporaryerrorscope? |
+1 for removing
OK, with the caveat that (1)-logging of errors and (2)-final presentation of fatals are different things, I think I agree that we need a better interface to customize (1)-logging. The current interfaces are bit piecemeal/incomplete. If I interpret correctly, you're looking for an interface along the lines of one of these: ## Tapping into core logging - if core used Monolog
Civi::log()->pushHandler(new CRM_Reporterror_LogHandler());
## Tapping into core logging - via internal-event
Civi::dispatcher()->addListener('civi.log.append', function($logMsg){
// use $logMsg->level, $logMsg->message, $logMsg->context
});
## Tapping into core logging - via public-hook
function reporterror_civicrm_log($level, string $message, array $context) {
...
}
## Tapping into core logging - replace psr_log
function reporterror_civicrm_container($c) {
$container->setDefinition('psr_log', new Definition('CRM_Reporterror_Log', []))->setPublic(TRUE);
}
## Tapping into core logging - similar style to Monolog, but repurpose some PSR-3 interfaces
Civi::log()->addLogger(new \MyPsr3Logger()); And there would be an expectation that (whichever notation it is) it would get access to all error messages, whether they're submitted to There are some implied variations in those examples:
However, the thing that strikes me most is that they all have a bootstrap issue. Basically, if the logging is "extensible", then it takes a few more moments before the "extension" comes online. Some errors that arise early (like if the MySQL/Redis credentials are bad or if the data-store is unavailable) can never be reported to an "extensible" logger... because our "extensibility" patterns (hooks, extension-modules, APIvX, settings, containers, etc) aren't available until latter part of bootstrap. IMHO, there are two basic ways to address that:
NOTE: Related discussion: https://lab.civicrm.org/community/feature-request/-/issues/12 |
…rror::debug_log_message
Overview
This removes the call to the custom fatal error that is proving to be problematic as per the report in the lab ticket https://lab.civicrm.org/dev/mail/-/issues/72
Before
Custom fatal error handler called from debug_log_message causing an exception to be thrown which blocks email sending
After
Email not blocked in sending
ping @MegaphoneJon @totten @eileenmcnaughton