Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.
MOZGIII edited this page Mar 22, 2019 · 3 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