logback-syslog4j

Logback appender using syslog4j to send via syslog

License

License

Categories

Categories

Logback Application Layer Libs Logging
GroupId

GroupId

com.papertrailapp
ArtifactId

ArtifactId

logback-syslog4j
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

logback-syslog4j
Logback appender using syslog4j to send via syslog
Project URL

Project URL

https://github.com/papertrail/logback-syslog4j
Source Code Management

Source Code Management

https://github.com/papertrail/logback-syslog4j

Download logback-syslog4j

How to add to project

<!-- https://jarcasting.com/artifacts/com.papertrailapp/logback-syslog4j/ -->
<dependency>
    <groupId>com.papertrailapp</groupId>
    <artifactId>logback-syslog4j</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.papertrailapp/logback-syslog4j/
implementation 'com.papertrailapp:logback-syslog4j:1.0.0'
// https://jarcasting.com/artifacts/com.papertrailapp/logback-syslog4j/
implementation ("com.papertrailapp:logback-syslog4j:1.0.0")
'com.papertrailapp:logback-syslog4j:jar:1.0.0'
<dependency org="com.papertrailapp" name="logback-syslog4j" rev="1.0.0">
  <artifact name="logback-syslog4j" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.papertrailapp', module='logback-syslog4j', version='1.0.0')
)
libraryDependencies += "com.papertrailapp" % "logback-syslog4j" % "1.0.0"
[com.papertrailapp/logback-syslog4j "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
ch.qos.logback : logback-core jar 1.1.2
ch.qos.logback : logback-classic jar 1.1.2
org.syslog4j : syslog4j jar 0.9.30

test (1)

Group / Artifact Type Version
junit : junit jar 3.8.1

Project Modules

There are no modules declared in this project.

logback-syslog4j

A Logback appender that leverages syslog4j to send log messages to remote systems via syslog.

Why?

The existing syslog appender for Logback only provides the ability to send messages via UDP. Using syslog4j allows us to send messages via TCP and optionally to encrypt them by sending over TCP with TLS.

How?

Add this to your pom.xml:

    <dependency>
      <groupId>com.papertrailapp</groupId>
      <artifactId>logback-syslog4j</artifactId>
      <version>1.0.0</version>
    </dependency>

Then add the appender to your logback.xml.

If not using Maven, download logback-syslog4j-1.0.0.jar and the latest syslog4j JAR. Place these files in the classpath, in addition to Logback itself.

Logging via TCP with TLS (recommended)

  <appender name="SYSLOG-TLS" class="com.papertrailapp.logback.Syslog4jAppender">
    <layout class="ch.qos.logback.classic.PatternLayout">
      <pattern>%-5level %logger{35}: %m%n%xEx</pattern>
    </layout>

    <syslogConfig class="org.productivity.java.syslog4j.impl.net.tcp.ssl.SSLTCPNetSyslogConfig">
      <!-- remote system to log to -->
      <host>localhost</host>
      <!-- remote port to log to -->
      <port>514</port>
      <!-- program name to log as -->
      <ident>java-app</ident>
      <!-- max log message length in bytes -->
      <maxMessageLength>128000</maxMessageLength>
    </syslogConfig>
  </appender>

  <root level="DEBUG">
    <appender-ref ref="SYSLOG-TLS" />
  </root>

Logging via TCP

  <appender name="SYSLOG-TCP" class="com.papertrailapp.logback.Syslog4jAppender">
    <layout class="ch.qos.logback.classic.PatternLayout">
      <pattern>%-5level %logger{35}: %m%n%xEx</pattern>
    </layout>

    <syslogConfig class="org.productivity.java.syslog4j.impl.net.tcp.TCPNetSyslogConfig">
      <!-- remote system to log to -->
      <host>localhost</host>
      <!-- remote port to log to -->
      <port>514</port>
      <!-- program name to log as -->
      <ident>java-app</ident>
      <!-- max log message length in bytes -->
      <maxMessageLength>128000</maxMessageLength>
    </syslogConfig>
  </appender>

  <root level="DEBUG">
    <appender-ref ref="SYSLOG-TCP" />
  </root>

Logging via UDP

  <appender name="SYSLOG-UDP" class="com.papertrailapp.logback.Syslog4jAppender">
    <layout class="ch.qos.logback.classic.PatternLayout">
      <pattern>%-5level %logger{35}: %m%n%xEx</pattern>
    </layout>

    <syslogConfig class="org.productivity.java.syslog4j.impl.net.udp.UDPNetSyslogConfig">
      <!-- remote system to log to -->
      <host>localhost</host>
      <!-- remote port to log to -->
      <port>514</port>
      <!-- program name to log as -->
      <ident>java-app</ident>
    </syslogConfig>
  </appender>

  <root level="DEBUG">
    <appender-ref ref="SYSLOG-UDP" />
  </root>
com.papertrailapp

Papertrail

Versions

Version
1.0.0