tjahzi
tjahzi copied to clipboard
Is it possible to use this appender with a json layout?
Like the title sais, I want to send my log file to loki but in a json format.
As far as I am aware, This is the way to do it normally:
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.contrib.json.classic.JsonLayout">
<jsonFormatter class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter"/>
<timestampFormat>yyyy-MM-dd HH:mm:ss.SSS</timestampFormat>
<appendLineSeparator>true</appendLineSeparator>
</layout>
</appender>
Is it possible to do this using this appender? I tried everything I could think of but I think that this way doesnt work because this appender uses a "PatternLayout"
You are right. Thanks for doing due diligence. I had to read more about how Logback encoders and layouts work. I think I know how to fix the appender. It'll take few days before I have time to release new version.
No problem :) Fyi: I found a workaround by defining my own converter. Maybe thats one way to implement it
Oops. Wrong account