tinylog-gelf

Writer implementation for tinylog to support logging with GELF messages

License

License

Categories

Categories

tinylog Application Layer Libs Logging
GroupId

GroupId

com.github.joschi
ArtifactId

ArtifactId

tinylog-gelf
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

tinylog-gelf
Writer implementation for tinylog to support logging with GELF messages
Project URL

Project URL

https://github.com/joschi/tinylog-gelf
Source Code Management

Source Code Management

https://github.com/joschi/tinylog-gelf

Download tinylog-gelf

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
org.graylog2 : gelfclient jar 1.3.0

provided (1)

Group / Artifact Type Version
org.tinylog : tinylog jar 1.0

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-core jar 1.10.19
org.slf4j : slf4j-simple jar 1.7.12

Project Modules

There are no modules declared in this project.

This project has been deprecated.

tinylog-gelf

Build Status

tinylog-gelf is a Writer implementation for tinylog writing log messages to a GELF compatible server like Graylog2 or logstash.

Configuration

The following configuration settings are supported by tinylog-gelf:

  • server (default: localhost)
    • The hostname of the GELF-compatible server.
  • port (default: 12201)
    • The port of the GELF-compatible server.
  • transport (default: UDP)
    • The transport protocol to use, valid settings are UDP and TCP.
  • hostname (default: local hostname or localhost as fallback)
    • The hostname of the application.
  • additionalLogEntryValues (default: DATE, LEVEL, RENDERED_LOG_ENTRY)
  • staticFields (default: empty)
    • Additional static fields for the GELF messages.

Additional configuration settings are supported by the GelfWriter class. Please consult the Javadoc for details.

Examples

tinylog-gelf can be configured using a properties file/system properties or via the fluent API.

Properties file example:

tinylog.writer=gelf
tinylog.writer.server=graylog2.example.com
tinylog.writer.port=12201
tinylog.writer.transport=TCP
tinylog.writer.hostname=myhostname
tinylog.writer.additionalLogEntryValues=EXCEPTION,FILE,LINE
tinylog.writer.staticFields=additionalfield1:foo,additionalfield2:bar

Fluent API example:

GelfWriter gelfWriter = new GelfWriter("graylog2.example.com", 12201, 
                                       GelfTransports.UDP, "myhostname",
                                       EnumSet.of(LogEntryValue.EXCEPTION),
                                       Collections.<String, Object>emptyMap())
Configurator.defaultConfig()
            .writer(gelfWriter)
            .level(Level.INFO)
            .activate();

Maven Artifacts

This project is available on Maven Central. To add it to your project simply add the following dependencies to your pom.xml:

<dependency>
  <groupId>com.github.joschi</groupId>
  <artifactId>tinylog-gelf</artifactId>
  <version>0.2.0</version>
</dependency>

Support

Please file bug reports and feature requests in GitHub issues.

License

Copyright (c) 2014 Jochen Schalanda

This library is licensed under the Apache License, Version 2.0.

See http://www.apache.org/licenses/LICENSE-2.0.html or the LICENSE file in this repository for the full license text.

Versions

Version
0.3.0
0.2.0
0.1.0