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

Add JSON log format #91

Open
weeco opened this issue Jul 7, 2019 · 1 comment
Open

Add JSON log format #91

weeco opened this issue Jul 7, 2019 · 1 comment
Labels
backend Need a backend update enhancement New feature or request good first issue Good for newcomers

Comments

@weeco
Copy link

weeco commented Jul 7, 2019

An option to enabled structured JSON logging is desirable as we can parse this information in our environment, so that we can better process logs.

@tchiotludo tchiotludo added the enhancement New feature or request label Jul 11, 2019
@HungUnicorn
Copy link

HungUnicorn commented Jan 6, 2020

I received similar request months ago. My solution is by providing a logback.xml

<?xml version="1.0" encoding="UTF-8"?>
      <configuration>
        <property name="pattern" value="{&quot;ProdUser&quot;:&quot;kafkahq&quot;, &quot;App_Time&quot;: &quot;%d&quot;, &quot;LogLevel&quot;: &quot;%p&quot;, &quot;class&quot;: &quot;%logger{63}:%L&quot;, &quot;message&quot;: &quot;%replace(%m){'[\r\n]+', '\\n'}%nopex&quot;}%n" />
        <appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
            <encoder>
                <pattern>${pattern}</pattern>
            </encoder>
        </appender>
        <logger name="jsonLogger" additivity="false" level="DEBUG">
            <appender-ref ref="consoleAppender"/>
        </logger>
        <root level="INFO">
            <appender-ref ref="consoleAppender"/>
        </root>
      </configuration>

and start the application with java - -Dlogback.configurationFile=file:/etc/kafkahq-logback/logback.xml

If you also use helm-chart, my log configuration is in a configmap, and the above is placed in container command

ghost pushed a commit that referenced this issue Jun 19, 2020
@tchiotludo tchiotludo added backend Need a backend update good first issue Good for newcomers labels Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Need a backend update enhancement New feature or request good first issue Good for newcomers
Projects
Status: To do
Development

No branches or pull requests

3 participants