logback-journal


License

License

Categories

Categories

Logback Application Layer Libs Logging
GroupId

GroupId

org.gnieh
ArtifactId

ArtifactId

logback-journal
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

bundle
Description

Description

logback-journal
logback-journal
Project URL

Project URL

https://github.com/gnieh/logback-journal
Project Organization

Project Organization

org.gnieh
Source Code Management

Source Code Management

https://github.com/gnieh/logback-journal

Download logback-journal

Dependencies

compile (2)

Group / Artifact Type Version
net.java.dev.jna : jna jar 4.4.0
ch.qos.logback : logback-classic jar 1.2.3

test (1)

Group / Artifact Type Version
com.novocode : junit-interface jar 0.11

Project Modules

There are no modules declared in this project.

Maven Central

logback-journal

systemd journal appender for Logback.

Installation

This appender is published in sonatype maven repository. If you are using maven, simply add the following in your pom.xml

<dependency>
  <groupId>org.gnieh</groupId>
  <artifactId>logback-journal</artifactId>
  <version>0.3.0</version>
</dependency>

if you are using sbt, add this to your build.sbt

libraryDependencies += "org.gnieh" % "logback-journal" % "0.3.0"

You also need the systemd journal library installed on your system to log to it. For newest version of systemd, journal is integrated in the systemd base library. Older version had a separate library named systemd-journal. This appender use systemd as a library by default. You can change this by using the systemd.library JVM property (e.g. -Dsystemd.library=systemd-journal)

Configuration

Basic configuration to use the systemd journal appender looks like this:

<configuration>

  <appender name="journal" class="org.gnieh.logback.SystemdJournalAppender" />

  <root level="debug">
    <appender-ref ref="journal" />
  </root>
</configuration>

The appender can be configured with the following properties

Property name Type Description Default Value
logLocation boolean Determines whether the exception locations are logged when present. This data is logged in standard systemd journal fields CODE_FILE, CODE_LINE and CODE_FUNC. true
logSourceLocation boolean Determines whether the source locations are logged when present. Note that there is a performance overhead when switched on. This data is logged in standard systemd journal fields CODE_FILE, CODE_LINE and CODE_FUNC. false
logException boolean Determines whether the exception name and messages are logged. This data is logged in the user fields EXN_NAME and EXN_MESSAGE. true
logStackTrace boolean Determines whether the exception stack trace is logged. This data is logged in the user field EXN_STACKTRACE. false
logThreadName boolean Determines whether the thread name is logged. This data is logged in the user field THREAD_NAME. true
logLoggerName boolean Determines whether the logger name is logged. This data is logged in the user field LOGGER_NAME. false
logMdc boolean Determines whether the MDC content is logged. Each key/value pair is logged as user field with the mdcKeyPrefix prefix. false
mdcKeyPrefix String Determines how MDC keys should be prefixed when logMdc is set to true. Note that keys need to match the regex pattern [A-Z0-9_]+ and are normalized otherwise. ""
syslogIdentifier String Overrides the syslog identifier string. This data is logged in the user field SYSLOG_IDENTIFIER. The process name (i.e. "java")
org.gnieh

Gnieh

Gnieh Development Team

Versions

Version
0.3.0
0.2.0
0.1.0