-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log format experiments #26676
Log format experiments #26676
Conversation
@DeepDiver1975 @butonic @cdamken do we agree on the general idea that we want to bring "exception" on the same level as the other attributes in the log ? I had to do some code magic to pass the exception as If not then it will be impossible to make it look nice when json-formatted because the exception will always be inside an escaped string. |
@PVince81, thanks for your PR! By analyzing the history of the files in this pull request, we identified @DeepDiver1975, @pierrejochem and @MorrisJobke to be potential reviewers. |
@PVince81 I'm agree, the last one is the nicest and the easiest to have quick overview. IMO we could also have it that way or with the option to have in all in one line with an "\n" or other character that can be easy identified and that way it can be separated if required or per line. |
@cdamken the original format already had I find it neat if all one needs is |
this is awesome. Definitely pull the exception up to a top level member. I'd go with the last version. The stacktrace analyzer of PHP seems to accept only the native log format or a full thread dump ... so we need to make this as humanly readable as possible. |
Ok, will do:
|
|
0fd9261
to
423ec4b
Compare
423ec4b
to
cf4f12c
Compare
Slightly related for extra fields: #31121 Might be reusable for this PR about exceptions by passing it as extra field. |
will be obsoleted by #31623 |
Make the log looks a bit better when containing exceptions.
To test, do a PROPFIND on any folder and look at the look.
Also tweak the boolean flags inside
Log::processException()
.The formatting was done by piping the row into
jsonlint -p
Log exception on the same level as other fields with string stack trace
Uses
getTraceAsString
for the stack,$jsonStack=false; $jsonStringStack = false;
;Unformatted:
Formatted:
This already looks nice but doesn't format the stack trace properly.
Log on same level as other fields but with JSON stack trace
Uses
getTrace()
for the stack and puts the items into a JSON sub-array.$jsonStack=true;
As you can see there are LOTS of details in there, perhaps too much.
Unformatted:
Formatted:
Log on same level as other fields but take the string trace rows and put these into a JSON array
$jsonStack=false; $jsonStringStack = true;
Unformatted:
Formatted:
Perhaps the last one is the nicest.
Also note that I added
JSON_UNESCAPED_SLASHES
to avoid the annoying\/
...