Open mmurto opened 3 days ago
Stacktraces without line breaks are hardly readable, could the solution be to log JSON instead of plain text?
JSON for all logging would be even better!
I'm surprised that the logger does not automatically prefix stacktrace lines if an exception is passed to the logger call.
Actually, the above example seems to not come from a case where the logger takes an exception, but a plain uncaught exception being thrown (coincidentally preceded by a log message).
Actually, the above example seems to not come from a case where the logger takes an exception, but a plain uncaught exception being thrown (coincidentally preceded by a log message).
There could be a way to override all logging with the chosen format, which would uncaught exceptions and log those to JSON as well. Something like this maybe.
uncaught exceptions and log those
The emphasis is "uncaught". If exception are uncaught, they're also not intercepted in order to log them, but instead the JVM will just print the stacktrace to stderr, bypassing any logger.
We could probably use an UncaughtExceptionHandler and log from there, but I'm not sure whether that's really worth the effort.
Log aggregators often process logs line by line. Most of the ORT Server's log calls seem to be on one line, but exception stacktraces are not:
These would be easier to process and debug if they were on one line as well.