Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#18 | 2777955-18.patch | 4.92 KB | amontero |
#14 | interdiff-2777955-12-14.txt | 3.26 KB | aerozeppelin |
#14 | 2777955-14.patch | 4.51 KB | aerozeppelin |
#12 | interdiff-2777955-8-12.txt | 1.98 KB | aerozeppelin |
#12 | 2777955-12.patch | 2.42 KB | aerozeppelin |
Comments
Comment #2
aerozeppelin CreditAttribution: 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 CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting 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 CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting 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 CreditAttribution: aerozeppelin commentedChanges as per #9.
Comment #13
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting 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 CreditAttribution: 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 CreditAttribution: David_Rothstein as a volunteer commentedComment #17
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting 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 CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting 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
rcodina CreditAttribution: rcodina commentedI've been testing patch on #18 and it works for me.
Comment #27
joseph.olstadI like!