Follow-up to #2638140: Error logging should log a backtrace consistently
Problem/Motivation
Software has bugs, so errors are there and will be logged.
Sadly by default Drupal just puts the line of the broken code, which is already helpful, but on the other hand often now really helpful, because you need a full backtrace to figure something out.
Proposed resolution
Log a backtrace on top of the actual error message.
This will just make the backtrace available in the variables section, but won't be displayed as part of the watchdog site.
D7: Make the new setting opt-in and provide a way to get the value.
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
aerozeppelin commentedAn initial attempt to port the patch to D7. Not sure if I am heading in the right direction. Any inputs would be helpful.
Comment #6
rachel_norfolkIt seems the method here of creating the exception is not liked by php53.
Maybe need to be a little more long-handed about it?
Comment #7
fabianx commentedYes, a variable "$e = new Exception();" is fine to use here.
Comment #8
rachel_norfolkSo, we should end up with something like the attached for php53 friendliness...
Comment #9
fabianx commentedWe need to document this variable and maybe rename it a little ore verbose:
drupal_error_log_backtrace
maybe?
Are we sure we only want that for fatal errors?
Comment #10
rachel_norfolkComment #11
rachel_norfolkComment #12
aerozeppelin commentedChanges as per #9.
Comment #13
fabianx commentedThank you for your work on this!
Some more things:
For BC reasons, the default needs to be FALSE.
And we need to document the new value in settings.php.
Oh - I think I misread, that, yes we likely want to do this whole block only for fatal errors, but for both if and else.
Comment #14
aerozeppelin commentedYou're welcome. Thank you for reviewing my patch. I've updated my patch with the changes. Let's see what the test bot thinks.
Comment #16
David_Rothstein commentedComment #17
fabianx commentedLooks pretty good to me, still unsure about the helper function.
Comment #18
amonteroNeed this and wanting to work on it.
Stale patch, reroll, feed the testbot.
Comment #20
fabianx commentedMoving into 7.60 sprint
Comment #21
joseph.olstadPlease do not be alarmed by "composer Command Failed" - this is not an indication of a problem with the patch.
It occurs since approximately may 4th, there is a known testrunner issue. @mixologic (responsible for the testrunner) is on vacation
#2970950: D7 test runner not working since may 4th 2018 'Composer command failed'
Hopefully @mixologic gets back from his vacation soon.
Comment #22
joseph.olstadre-trigger testbot
Comment #24
joseph.olstadComment #25
joseph.olstadBumping to 7.70. This didn't make it into 7.60
Comment #26
rcodinaI've been testing patch on #18 and it works for me.
Comment #27
joseph.olstadI like!