idosun / java-spring-boot-log4j

How Sentry is configured in a Java application using Log4j

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sentry Log4J2 + Java Agent Demo

This project contains an example Sentry integration with a Spring Boot application. It uses the default log4j logging framework to send log level WARN and above to sentry via the log4j Sentry integration/SDK, and the agent will enhance your application stack traces on Sentry by adding the names and values of local variables to each frame.

Installation and Configuration

  1. Add the Sentry Log4j2 package to the pom.xml file.
  2. Specify DSN in sentry.properties
  3. SENTRY_AUTH_TOKEN must be set as ENV var (for consumption by sentry-cli in Makefile)
  4. Add the logger configuration file (log4j2.xml)

The example application can be started as follows:

    make

Now, visit http://localhost:8080/handled in your browser and an error with full context (including stack locals / variasble values) should be sent to Sentry.

Documentaion:

GIF

Alt Text

About

How Sentry is configured in a Java application using Log4j


Languages

Language:Java 92.2%Language:Makefile 7.8%