If I stop the database server of my Drupal site and browse it, I get an error page with:
PDOException: SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in lock_may_be_available() (line 167 of /var/www/includes/lock.inc).
My concern is that I do not see any error in either web server error log file or syslog file.
I guess such errors were intended to go into watchdog (cf. line 214 of includes/errors.inc) but in such case module_implements('watchdog') does not return anything as the modules list cannot be retrieved.
I would suggest using error_log() in _drupal_log_erro() for any fatal error. Any opinion about that?
Comments
Comment #1
marcingy commentedThis is not a major bug.
Comment #2
sdelbosc commentedI do not agree with the priority you used.
We must be aware of any service outage and due to this issue we may miss some of them. That is the reason why I used major priority.
Comment #3
marcingy commentedBut the priority is not major in terms of the drupal project - it might be for your business but not for the project.
Comment #4
sdelbosc commentedUnderstood.
Comment #5
superspring commentedThis patch logs exceptions to the error log when they are thrown in odd places (such as when the database is down).
Comment #6
adamdicarlo commentedLooks like the only code added is the error_log() call - the rest of the patch fixes the comment line length and fixes indentation. Looks good to me.
Comment #7
josh waihi commentedRTBC as per #6
Comment #8
catchThis comment isn't going to be true when error_displayable() is converted to config():
That's not the fault of this patch so I opened #1845646: error_displayable() cannot be converted from variable system safely. Committed/pushed to 8.x.
Is this worth a Drupal 7 backport?
Comment #9
sunIt's possible that this might have been the fix for the sporadically appearing PHP notice mentioned in #1158322: Add backtrace to all errors — I did not verify that though.
Comment #10
superspring commentedSame patch in D7.