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

Structured logging vs console output #138

Open
skjolber opened this issue Feb 21, 2022 · 1 comment
Open

Structured logging vs console output #138

skjolber opened this issue Feb 21, 2022 · 1 comment

Comments

@skjolber
Copy link

Is your feature request related to a problem? Please describe.
We have been using structured logging directly to console for quite some time for our kubernetes JVMs. However it seems the current implementation of this library only supports JSON to file.

Describe the solution you'd like
Support JSON output to console as well, for deployed (production) workloads. For local development, we like plain old one-line logging. Unit testing against resulting JSON output should still work in development.

Describe alternatives you've considered
None

Additional context
Our agent requires "one linebreak per log statement".

@wsargent
Copy link
Contributor

The logback-structured-config module is a packaging of logstash-logback-encoder that writes to a file amongst other things, but it's possible to set up the encoder to write to CONSOLE in exactly the same way.

The documentation at https://tersesystems.github.io/terse-logback/1.0.0/guide/structured-config/ explains how to set up appenders and multiple encoders

https://github.com/tersesystems/terse-logback/blob/master/logback-structured-config/src/main/resources/terse-logback/appenders/jsonfile-appenders.xml

And there's also https://github.com/tersesystems/terse-logback-showcase which shows some more options.

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

2 participants