# Log4j 2 Error Monitoring

> Prevent crashes & improve your Log4j 2 app performance with Log4j 2 error monitoring. Get started for free or request a demo with Sentry today.

**URL:** https://sentry.io/for/log4j2/

---

Debug Log4j 2 apps and prevent crashes across your entire stack with Sentry. Improve your Log4j 2 monitoring workflow with a full view of releases so you can triage errors and prioritize live issues.

**Documentation:** [https://docs.sentry.io/platforms/java/guides/log4j2/](https://docs.sentry.io/platforms/java/guides/log4j2/)

## Install

Grab the [Sentry Java SDK](https://github.com/getsentry/sentry-java/):

```xml
<dependency>
  <groupId>io.sentry</groupId>
  <artifactId>sentry-log4j2</artifactId>
  <version>8.61.1</version>
</dependency>
```

Configure your DSN in `log4j2.xml`:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
        <Sentry name="Sentry"
                dsn="https://<key>@sentry.io/<project>" />
    </Appenders>
    <Loggers>
        <Root level="info">
            <AppenderRef ref="Console"/>
            <AppenderRef ref="Sentry" level="error"/>
        </Root>
    </Loggers>
</Configuration>
```

See the [Log4j 2 docs](https://docs.sentry.io/platforms/java/guides/log4j2/) for full setup options.

## Features

### Log4j2 Error Monitoring with Complete Stack Traces

See details like filename and line number so you never have to guess. Filter and group Log4j2 exceptions intuitively to eliminate noise. Monitor errors at scale without impacting throughput in production.

### Fill In the Blanks About Log4j2 Errors

Expose the important events that led to each Java exception: debug logs, network requests, database queries, past errors.

### Resolve Log4j2 Errors With Max Efficiency, Not Max Effort

Learn in which version a bug first appeared, merge duplicates, and know if things regress in a future release. Add commit data to automatically suggest an owner of each Log4j2 error and instantly send deploy emails.

---

*Source: [sentry.io/for/log4j2/](https://sentry.io/for/log4j2/)*
