---
title: "Feature Flags"
description: "With Feature Flags, Sentry tracks feature flag evaluations in your application, keeps an audit log of feature flag changes, and reports any suspicious updates that may have caused an error."
url: https://docs.sentry.io/platforms/java/guides/log4j2/feature-flags/
---

# Set Up Feature Flags | Sentry for Log4j 2.x

## [Prerequisites](https://docs.sentry.io/platforms/java/guides/log4j2/feature-flags.md#prerequisites)

* You have the [Java SDK installed](https://docs.sentry.io/platforms/java/guides/log4j2.md).

## [Enable Evaluation Tracking](https://docs.sentry.io/platforms/java/guides/log4j2/feature-flags.md#enable-evaluation-tracking)

If you use a third-party SDK to evaluate feature flags, you can enable a Sentry SDK integration to track those evaluations. Integrations are provider specific. Documentation for supported SDKs is listed below.

* [OpenFeature](https://docs.sentry.io/platforms/java/guides/log4j2/integrations/openfeature.md)
* [LaunchDarkly](https://docs.sentry.io/platforms/java/guides/log4j2/integrations/launchdarkly.md)

### [Generic API](https://docs.sentry.io/platforms/java/guides/log4j2/feature-flags.md#generic-api)

If you use an unsupported solution, you can use the generic API to manually track feature flag evaluations. These evaluations are held in memory and are sent to Sentry on error and transaction events. **At the moment, we only support boolean flag evaluations.**

```java
import io.sentry.Sentry;


Sentry.addFeatureFlag("feature_flag.test-flag", false);

Sentry.captureException(new Exception("Something went wrong!"));
```

Go to your Sentry project and confirm that your error event has recorded the feature flag "test-flag" and its value "false".

## [Enable Change Tracking](https://docs.sentry.io/platforms/java/guides/log4j2/feature-flags.md#enable-change-tracking)

Change tracking requires registering a Sentry webhook with a feature flag provider. For set up instructions, visit the documentation for your provider:

* [Flagsmith](https://docs.sentry.io/organization/integrations/feature-flag/flagsmith.md#change-tracking)
* [LaunchDarkly](https://docs.sentry.io/organization/integrations/feature-flag/launchdarkly.md#change-tracking)
* [Statsig](https://docs.sentry.io/organization/integrations/feature-flag/statsig.md#change-tracking)
* [Unleash](https://docs.sentry.io/organization/integrations/feature-flag/unleash.md#change-tracking)
* [Generic](https://docs.sentry.io/organization/integrations/feature-flag/generic.md#change-tracking)
