I am deploying my application to Azure kubernetes with Log monitoring. For readability issues with error logs I'd like to log to JSON instead of console lines. I've been using default logback configuration and now I am trying to change it just to change the format of logs.
logback-spring.xml:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<appender name="jsonAppender" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.contrib.json.classic.JsonLayout">
<jsonFormatter
class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter">
<prettyPrint>true</prettyPrint>
</jsonFormatter>
<timestampFormat>yyyy-MM-dd' 'HH:mm:ss.SSS</timestampFormat>
</layout>
</appender>
<root level="INFO">
<appender-ref ref="jsonAppender"/>
</root>
</configuration>
It works perfectly on local (also in Docker), however after deploy to AKS there is still old log format. Does anyone know what is causing this?
EDIT The main problem was in packaging - logback-spring.xml was not part of my production jar. So now I have JSON logs in my Log Analytics but stacktraces are still on separate lines outside of JSON and I cannot get them into the object.