Skip to content

Terse Logback

Terse Logback is a collection of Logback extensions that shows how to use Logback effectively for structured logging, ringbuffer logging, system instrumentation, and JDBC.

Using Terse Logback increases the observability of your application. Or as @mipsytipsy puts it:

I've written about the reasoning and internal architecture in a series of blog posts. The full list is available on https://tersesystems.com.

Showcase

If you want to see a running application, there is a showcase web application that run out of the box that demonstrates some of the more advanced features, and shows you can integrate terse-logback with Sentry and Honeycomb.

Quickstart

You want to start up a project immediately and figure things out? Okay then.

The project is configured into several modules. The most relevant one to start with is logback-structured-config which gives you a starting point.

The logback-structured-config module contains all the logback code and the appenders, and is intended to be deployed as a small helper library for your other projects, managed through Maven and an artifact manager, or just by packaging the JAR.

You can see it on mvnrepository but you will need a custom resolver, so better to read through the whole thing.

This is not intended to be a drop in solution or a straight library dependency. You will want to modify this to your own tastes.

Installation

See the installation guide.

Configuration

After you've set up the resolvers and library dependencies for your build, you'll add the following to src/main/resources/logback.xml:

<configuration debug="true">
  <include resource="terse-logback/default.xml"/>
</configuration>

Then add a logback.conf file that contains the following:

levels {
  ROOT = DEBUG
}

That should give you a fairly verbose logging setup and allow you to change the configuration. See the reference section for more details.