Espen Fossen edited this page Jun 4, 2016 · 2 revisions

The Logback JSON extension allows log messages to be formatted as JSON. It must be paired with another extension that enables your desired JSON Processor (see below).

This extension is organized as 3 modules:

JSON Processor

The above JSON modules provide only general Logback JSON support. They cannot function alone - they must be paired with a JSON Processor of your choice, based on your application's runtime requirements.

The logback-ext-jackson module is currently the only out-of-the-box JSON Processor module, which uses the Jackson JSON Processor - a very common processor in Java applications. Additional JSON processor module implementations can be added by the community as necessary.

Usage

  1. Add the following .jars to your application's classpath:
Jar Maven or Ant+Ivy
logback-ext-json-core-version.jar Not necessary. Pulled automatically by other dependencies below.
logback-ext-json-classic-version.jar
<dependency>
        <groupId>ch.qos.logback.extensions</groupId>
        <artifactId>logback-ext-json-classic</artifactId>
        <version>version</version>
        <scope>runtime</scope>
</dependency>
logback-ext-jackson-version.jar
<dependency>
        <groupId>ch.qos.logback.extensions</groupId>
        <artifactId>logback-ext-jackson</artifactId>
        <version>version</version>
        <scope>runtime</scope>
</dependency>
A Jackson implementation .jar of your choice1
<dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>Jackson Version</version>
        <scope>runtime</scope>
</dependency>
1 Logback Extensions compiles against Jackson 1.9.5 or later, but should work with most earlier Jackson versions. 2. Configure `logback.xml` Example TBD
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.