my log statements sometimes has a stack trace.
Like this: “stacktrace”: “java.lang.RuntimeException: This is an error\n\tat io.myapp.LoggerTest.main(LoggerTest.java:23)\n”.
It has \n symbols, but by default it is displayed as one line, without carriage return.
Grafana shows me a message “Your logs might have incorrectly escaped content” and offers to escape new lines.
When I agree, then my stack trace displayed very nice, with carriage return:
“stacktrace”:"java.lang.RuntimeException: This is an error
The same situation with nested json objects.
So my question is following: how should I format my logs to have new lines escaped correctly?
What stages to use?