Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use this appender with a json layout? #109

Open
SimonBalling opened this issue May 5, 2023 · 3 comments
Open

Is it possible to use this appender with a json layout? #109

SimonBalling opened this issue May 5, 2023 · 3 comments

Comments

@SimonBalling
Copy link

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"

@SimonBalling SimonBalling changed the title Is it possible to use this appender with aa json layout? Is it possible to use this appender with a json layout? May 5, 2023
@tkowalcz
Copy link
Owner

tkowalcz commented May 5, 2023

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.

@Urganot
Copy link

Urganot commented May 7, 2023

No problem :)
Fyi: I found a workaround by defining my own converter. Maybe thats one way to implement it

@SimonBalling
Copy link
Author

Oops. Wrong account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants