[5.4] Improve error logging in Mail API#48045
Conversation
Enhance error handling in Mail API by differentiating between error and debug messages.
|
I have not tested this item. Thanks @alikon This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48045. |
|
I have tested this item ✅ successfully on a3e4c0d This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48045. |
|
I have tested this item ✅ successfully on a3e4c0d Thanks @alikon This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48045. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48045. |
| // Configure a callback function to handle errors when $this->debug() is called | ||
| $this->Debugoutput = function ($message, $level) { | ||
| Log::add(\sprintf('Error in Mail API: %s', $message), Log::ERROR, 'mail'); | ||
| if (strpos(strtolower($message), 'fail') !== false || strpos(strtolower($message), 'error') !== false) { |
There was a problem hiding this comment.
This is not reliable solution. There are many different kind of error messages, and from what I see, some of the error messages can also be translated, so you cannot check for fail or error to determine of it is an error or a debug message.
There was a problem hiding this comment.
as i wrote this is an improvement, and it will catch most of the typical "error" messages, can you suggest other kind of "error" messages ?
as for the translated error messages, even if they are, they will be in low percentage
There was a problem hiding this comment.
Look at how Debugoutput is used in PHPMailer, I don't see a reliable way to handle it. I would leave the issue as won't fix instead of this unreliable solution
|
Returned to “Pending” status due to concerns This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48045. |
Enhance error handling in Mail API by differentiating between error and debug messages.
Pull Request resolves #45963 .
Summary of Changes
change LOG priority based if is an error or not
Testing Instructions
Actual result BEFORE applying this Pull Request
All log entries for sending e-mails have the priority ERROR
Expected result AFTER applying this Pull Request
if no errors logs priority DEBUG
Link to documentations
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed