Stack trace new lines escaping / formatting

Hi,

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
at io.myapp.LoggerTest.main(LoggerTest.java:23)
".

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?

1 Like

I have checked the internet, this community topics and this question is still not resolved.
So what symbols should be used to correctly escape new lines?

If you use “escape new lines” function and “prettify json” together - that breaks displaying of JSON.

This is important problem. PLEASE react.

1 Like

I’m also seeing this issue. It’s been eleven months. Is there any update?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.