Connect your Log4j 2.x project to GlitchTip


Using Maven:


Using Gradle:

compile 'io.sentry:sentry-log4j2:1.7.27'

Using SBT:

libraryDependencies += "io.sentry" % "sentry-log4j2" % "1.7.27"

For other dependency managers see the central Maven repository.


The following example configures a ConsoleAppender that logs to standard out at the INFO level and a SentryAppender that logs to the GlitchTip server at the WARN level. The ConsoleAppender is only provided as an example of a non-Sentry appender that is set to a different logging threshold, like one you may already have in your project.

Example configuration using the log4j2.xml format:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="warn" packages="org.apache.logging.log4j.core,io.sentry.log4j2">
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />

        <Sentry name="Sentry" />

        <root level="INFO">
            <appender-ref ref="Console" />
            <!-- Note that the Sentry logging threshold is overridden to the WARN level -->
            <appender-ref ref="Sentry" level="WARN" />

Next, you’ll need to configure your DSN (client key) and optionally other values such as environment and release. [See the configuration page]({%- link _documentation/clients/java/ -%}#configuration) for ways you can do this.