I\'m using SLF4J with Logback in a JAX-RS application... I want to log to JSON in such a way that my message is not encoded again but printed raw into the logfile:
At t
If you have a Json formatted messages, the upper solutions work, but are not so nice, since you don´t want to call a logstash specific code, each time you use your logger in the code.
Just adding a
net.logstash.logback.encoder.LogstashEncoder
is not enough, since the message itsself stays escaped. To solve this, try the following in your logback.xml:
{
"jsonMessage": "#asJson{%message}"
}
The #asJson pattern will unescape your message.