{ "html": "
Using Maven:
\n<dependency>\n <groupId>io.sentry</groupId>\n <artifactId>sentry-log4j2</artifactId>\n <version>1.6.3</version>\n</dependency>\n
Using Gradle:
\ncompile 'io.sentry:sentry-log4j2:1.6.3'\n
Using SBT:
\nlibraryDependencies += "io.sentry" % "sentry-log4j2" % "1.6.3"\n
For other dependency managers see the central Maven repository.
\nThe following example configures a ConsoleAppender
that logs to standard out\nat the INFO
level and a SentryAppender
that logs to the Sentry server at\nthe WARN
level. The ConsoleAppender
is only provided as an example of\na non-Sentry appender that is set to a different logging threshold, like one you\nmay already have in your project.
Example configuration using the log4j2.xml
format:
<?xml version="1.0" encoding="UTF-8"?>\n<configuration status="warn" packages="org.apache.logging.log4j.core,io.sentry.log4j2">\n <appenders>\n <Console name="Console" target="SYSTEM_OUT">\n <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />\n </Console>\n\n <Sentry name="Sentry" />\n </appenders>\n\n <loggers>\n <root level="INFO">\n <appender-ref ref="Console" />\n <!-- Note that the Sentry logging threshold is overridden to the WARN level -->\n <appender-ref ref="Sentry" level="WARN" />\n </root>\n </loggers>\n</configuration>\n
Next, you’ll need to configure your DSN (client key) and optionally other values such as\nenvironment
and release
. See the configuration page for ways you can do this.