---
title: "Sentry Local (Spotlight)"
description: "Learn how to send Sentry events from your Java app to Sentry Local (Spotlight) on your development machine."
url: https://docs.sentry.io/platforms/java/guides/log4j2/integrations/spotlight/
last_updated: 2026-12-05T20:08:11.000Z
---

# Sentry Local (Spotlight) for Log4j 2.x

Sentry Local (Spotlight) lets you inspect your app's errors, traces, and logs on your development machine while you develop. The SDK sends a copy of every Sentry event to [`sentry local`](https://cli.sentry.dev/commands/local/), a local server from Sentry CLI that prints events in your terminal and shows them in the [Sentry Local](https://local.sentry.dev) viewer.

The `sentry-spotlight` module provides a `SpotlightIntegration` that sends a copy of all Sentry events to the local server.

## [Install](https://docs.sentry.io/platforms/java/guides/log4j2/integrations/spotlight.md#install)

To install use:

```groovy
implementation 'io.sentry:sentry-spotlight:8.67.0'
```

*Other available variations of the above snippet: Maven, SBT*

For other dependency managers, check out the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-spotlight).

## [Configure](https://docs.sentry.io/platforms/java/guides/log4j2/integrations/spotlight.md#configure)

```text
enable-spotlight=true
# Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream)
spotlight-connection-url=http://localhost:8969/stream
```

```java
import io.sentry.Sentry;

Sentry.init(options -> {
    options.setDsn("https://<key>@o<orgId>.ingest.sentry.io/<projectId>");
    options.setEnableSpotlight(true);
    // Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream)
    options.setSpotlightConnectionUrl("http://localhost:8969/stream");
});
```

*Other available variations of the above snippet: Kotlin*

The default URL is `http://localhost:8969/stream`. You only need to set `spotlightConnectionUrl` if your local server is running on a different host or port.

## [Start the Local Server](https://docs.sentry.io/platforms/java/guides/log4j2/integrations/spotlight.md#start-the-local-server)

Install [Sentry CLI](https://cli.sentry.dev/getting-started/) on your development machine and start the local server, or run it with `npx`:

```bash
curl -fsSL https://sentry.io/get-cli/ | sh
sentry local serve
```

*Other available variations of the above snippet: npx*

If `sentry local serve` says a Sentry Local daemon is using the port, stop it with `sentry local daemon stop` (this ends its sessions), or pick another `--port` and change the SDK's Spotlight URL to match.

`sentry local serve` listens on port `8969`, which matches the default URL. Add `--open` to open the Sentry Local viewer in your browser.

To start the server together with your app, run your dev command with `sentry local run` instead, for example `sentry local run --port 8969 -- ./gradlew bootRun`. Keep `--port 8969`: the Java SDK doesn't read the `SENTRY_SPOTLIGHT` environment variable that `sentry local run` sets, and without a fixed port, the server can move to a free port when `8969` is taken.

## [Verify](https://docs.sentry.io/platforms/java/guides/log4j2/integrations/spotlight.md#verify)

To verify the integration is working, capture a test exception:

```java
import io.sentry.Sentry;

Sentry.captureException(new Exception("Spotlight test from Java!"));
```

*Other available variations of the above snippet: kotlin*

Confirm that the error appears in the terminal running `sentry local` or in the Sentry Local viewer.

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
