I have the below appender from my logback.xml file and I want to replace the ch.qos.logback.contrib library usages with something else because that library is vulnerable and not maintained anymore.
Do you guys have any ideas of some libs that I can replace this with?
<appender name="RollingFileJSON" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/json/app.log</file>
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="ch.qos.logback.contrib.json.classic.JsonLayout"> <!-- this -->
<timestampFormat>yyyy-MM-dd'T'HH:mm:ss.SSSX</timestampFormat>
<timestampFormatTimezoneId>Etc/UTC</timestampFormatTimezoneId>
<jsonFormatter class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter"> <!-- and this -->
<prettyPrint>true</prettyPrint>
</jsonFormatter>
</layout>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily and when the file reaches 10 MegaBytes -->
<fileNamePattern>logs/json/app-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
Basically what I'm trying to achieve is an appender which will log into a json format, on the same line.
I tried using the spring logging and also to simply use a pattern layout but it does not work properly (exception would not get added inside the json object, but outside and on a new line).
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>{"timestamp":"%d{yyyy-MM-dd'T'HH:mm:ss.SSSX}", "level":"%level", "logger":"%logger", "message":"%msg", "thread":"%thread"}%n</pattern>
</layout>