-
-
Notifications
You must be signed in to change notification settings - Fork 967
Description
Original Reporter: wangjammer5
Environment: Not Specified
Version: 1.3.6
Migrated From: http://jira.grails.org/browse/GRAILS-7232
I mentioned the idea to alter the output of stack traces on the list, and it was enthusiastically received.
Basically we'd either need to replace the printStackTrace impl or call our own stack dumper method whenever we dump traces. This may be non-trivial, but the gains will be significant.
Key requirements:
- Make it trivial for people to see the deepest point of the trace - the point of failure
- Hide groovy internals
- Make it easier for humans who are not Java gurus to scan
- Reduce duplication
Example desired output:
{code}
=============== GRAILS EXCEPTION ===================
Cannot get property 'userName' on null object (java.lang.NullPointerException)
doCall method on line 217 in NoticeUtilsService.groovy (NoticeUtilsService$_processResults_closure5_closure7)
Stack trace:
Line | Method
->> 217 | doCall in NoticeUtilsService.groovy
| | - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 216 | doCall in " "
| 214 | processResults in " "
| 129 | mapFields in KnownUserService.groovy
| 97 | sendMessage in NoticeEventsService.groovy
| 58 | noticeEvent in " "
| 199 | doCall in BoardAreaController.groovy
| 167 | doArchiveRestore in " "
| 127 | doCall in " "
^ 680 | run in Thread.java (java.lang)
See your unsanitized stack log for the full Java stack trace if necessary.
{code}
The detail is important here:
- It needs to calculate column widths for line number and method, and align all text correctly
- The arrows and separator are important visual cues
- The source file is shown in the stack trace lines, NOT the class name. the package name is included in brackets, no brackets shown at all if code is in the default package
- We need to filter out code with no source (Unknown Source)
- We need configurable sanitized packages, so users can add stuff to Config - or preferably they can specify the list of package prefixes that are in their app, in Config: grails.stack.packages=['org.myapp']
- Class names are in general not shown except in the first couple of lines of preamble.