logback-raygun

A logback appender that emits details to raygun.io.

License

License

Categories

Categories

Logback Application Layer Libs Logging
GroupId

GroupId

com.fatboyindustrial.logback-raygun
ArtifactId

ArtifactId

logback-raygun
Last Version

Last Version

1.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

logback-raygun
A logback appender that emits details to raygun.io.
Project URL

Project URL

https://github.com/gkopff/logback-raygun
Source Code Management

Source Code Management

https://github.com/gkopff/logback-raygun

Download logback-raygun

How to add to project

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

Dependencies

compile (6)

Group / Artifact Type Version
com.google.code.gson : gson jar 2.3.1
com.google.guava : guava jar 18.0
com.google.code.findbugs : jsr305 jar 2.0.3
org.slf4j : slf4j-api jar 1.6.6
ch.qos.logback : logback-classic jar 1.1.1
com.mindscapehq : core jar 2.0.0

test (2)

Group / Artifact Type Version
junit : junit jar 4.11
org.hamcrest : hamcrest-all jar 1.3

Project Modules

There are no modules declared in this project.

logback-raygun

A logback appender that emits details to raygun.io. It requires Java 7.

Getting it

<dependency>
  <groupId>com.fatboyindustrial.logback-raygun</groupId>
  <artifactId>logback-raygun</artifactId>
  <version>1.4.0</version>
</dependency>

Configuration

<configuration>
  <appender name="RAYGUN" class="com.fatboyindustrial.raygun.RaygunAppender">
    <apiKey><!-- insert key here --></apiKey>

    <!-- Optional: comma delimited tags to send with errors -->
    <tags>production,variant-a</tags>

    <!-- Deny all events with a level below WARN, that is: TRACE, DEBUG, INFO. -->
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
      <level>WARN</level>
    </filter>
  </appender>

  <root level="DEBUG">
    <appender-ref ref="RAYGUN"/>
  </root>

</configuration>

Any WARN or ERROR log messages will be posted to raygun. If the message contains an exception, then those exception details will be included. If no exception is included, then the log message is reported, with a synthesised 1 element long stack trace of the log message call-site.

Multiple API keys

It is possible to specify multiple API keys that apply to particular named hosts. This allows different hosts to log to different raygun applications (such as a testing environment application vs a production environment application).

When named API keys are used, raygun messages are suppressed if the hostname doesn't match a named entry. Named API keys use the following syntax:

  <apiKey>vogon:OpjzfzXvHooFqjyhT5311g== desiato:DYkfAazxL/HxiwnhtRkAvA==</apiKey>

The machine name (as reported by InetAddress.getLocalHost().getHostName()) is followed by a colon :, then the API key. Entries are separated by a space.

Log with an exception

The line:

LOG.warn("oh no, not again",
    new RuntimeException(
        new UnsupportedOperationException("petunias can't fly",
            new InputMismatchException())));

... produces:

Message oh no, not again; java.lang.RuntimeException: java.lang.UnsupportedOperationException: petunias can't fly; caused by: java.lang.UnsupportedOperationException: petunias can't fly; caused by: java.util.InputMismatchException

Class Name java.lang.RuntimeException

Stack Trace

oh no, not again; java.lang.RuntimeException: java.lang.UnsupportedOperationException: petunias can't fly; caused by: java.lang.UnsupportedOperationException: petunias can't fly; caused by: java.util.InputMismatchException
    com.fatboyindustrial.raygun.OtherClass.three in OtherClass.java:55
    com.fatboyindustrial.raygun.OtherClass.two in OtherClass.java:50
    com.fatboyindustrial.raygun.OtherClass.one in OtherClass.java:45
    com.fatboyindustrial.raygun.OtherClass.abc in OtherClass.java:40
    com.fatboyindustrial.raygun.RaygunTestApp.baz in RaygunTestApp.java:62
    com.fatboyindustrial.raygun.RaygunTestApp.bar in RaygunTestApp.java:57
    com.fatboyindustrial.raygun.RaygunTestApp.foo in RaygunTestApp.java:52
    com.fatboyindustrial.raygun.RaygunTestApp.entry in RaygunTestApp.java:47
    com.fatboyindustrial.raygun.RaygunTestApp.main in RaygunTestApp.java:41

Caused by; java.lang.UnsupportedOperationException: petunias can't fly; caused by: java.util.InputMismatchException
    com.fatboyindustrial.raygun.OtherClass.three in OtherClass.java:55
    com.fatboyindustrial.raygun.OtherClass.two in OtherClass.java:50
    com.fatboyindustrial.raygun.OtherClass.one in OtherClass.java:45
    com.fatboyindustrial.raygun.OtherClass.abc in OtherClass.java:40
    com.fatboyindustrial.raygun.RaygunTestApp.baz in RaygunTestApp.java:62
    com.fatboyindustrial.raygun.RaygunTestApp.bar in RaygunTestApp.java:57
    com.fatboyindustrial.raygun.RaygunTestApp.foo in RaygunTestApp.java:52
    com.fatboyindustrial.raygun.RaygunTestApp.entry in RaygunTestApp.java:47
    com.fatboyindustrial.raygun.RaygunTestApp.main in RaygunTestApp.java:41

Caused by; java.util.InputMismatchException
    com.fatboyindustrial.raygun.OtherClass.three in OtherClass.java:55
    com.fatboyindustrial.raygun.OtherClass.two in OtherClass.java:50
    com.fatboyindustrial.raygun.OtherClass.one in OtherClass.java:45
    com.fatboyindustrial.raygun.OtherClass.abc in OtherClass.java:40
    com.fatboyindustrial.raygun.RaygunTestApp.baz in RaygunTestApp.java:62
    com.fatboyindustrial.raygun.RaygunTestApp.bar in RaygunTestApp.java:57
    com.fatboyindustrial.raygun.RaygunTestApp.foo in RaygunTestApp.java:52
    com.fatboyindustrial.raygun.RaygunTestApp.entry in RaygunTestApp.java:47
    com.fatboyindustrial.raygun.RaygunTestApp.main in RaygunTestApp.java:41

Log without an exception

The line:

LOG.warn("I hope it will be friends with me.");

... produces:

Message I hope it will be friends with me.

Class Name com.fatboyindustrial.raygun.OtherClass

Stack Trace

I hope it will be friends with me.
    com.fatboyindustrial.raygun.OtherClass.three in OtherClass.java:53

MDC context

Custom data recorded in the SLF4J Mapped Diagnostic Context (MDC) is transmitted to Raygun as custom data. The Raygun tag name is the MDC key name with mdc: prefixed.

Versions

Version
1.4.0
1.3.0
1.2.0
1.1.0
1.0.0