From 3d559c5d0c50e936c5b9281dec9d87c71f014573 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Thu, 15 Oct 2026 01:00:55 +0000 Subject: [PATCH 1/7] feat(docs): Apply new quick start template to Java quick start guides Co-Authored-By: Shannon Anahata --- docs/platforms/java/common/index.mdx | 68 ++++++++++++++----- .../java/guides/spring-boot/index.mdx | 66 ++++++++++++++---- docs/platforms/java/guides/spring/index.mdx | 66 ++++++++++++++---- .../getting-started-config/java.jul.mdx | 11 +-- .../getting-started-config/java.log4j2.mdx | 54 +-------------- .../getting-started-config/java.logback.mdx | 57 +--------------- .../getting-started-config/java.mdx | 20 +----- .../getting-started-config/java.servlet.mdx | 21 +----- .../java.spring-boot.mdx | 16 +---- .../getting-started-config/java.spring.mdx | 8 +-- .../opentelemetry/java.mdx | 13 +--- .../opentelemetry/java.spring-boot.mdx | 19 ++++++ .../opentelemetry/java.spring.mdx | 34 ++++++++++ .../getting-started-install/java.jul.mdx | 10 --- .../getting-started-install/java.log4j2.mdx | 14 ---- .../getting-started-install/java.logback.mdx | 14 ---- .../getting-started-install/java.mdx | 10 --- .../getting-started-install/java.servlet.mdx | 10 --- .../java.spring-boot.mdx | 20 ------ .../getting-started-install/java.spring.mdx | 26 ------- .../opentelemetry/java.mdx | 2 - .../opentelemetry/java.spring-boot.mdx | 2 - .../opentelemetry/java.spring.mdx | 2 - .../getting-started-primer/java.jul.mdx | 2 +- .../getting-started-primer/java.log4j2.mdx | 2 +- .../getting-started-primer/java.logback.mdx | 2 +- 26 files changed, 232 insertions(+), 337 deletions(-) diff --git a/docs/platforms/java/common/index.mdx b/docs/platforms/java/common/index.mdx index 2f8445f0ca87d..b926c5722c7e5 100644 --- a/docs/platforms/java/common/index.mdx +++ b/docs/platforms/java/common/index.mdx @@ -1,41 +1,77 @@ - - -On this page, we get you up and running with Sentry's SDK. + - - - + -Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. + ## Install -Sentry captures data by using an SDK within your application’s runtime. +Install the Sentry SDK for your Java logging framework or application: +If you use the plain SDK setup in Configure, skip the agent download and launch command. + ## Configure - +**Error Monitoring** starts when the SDK initializes. This guide configures **Tracing** and **Profiling**. **Logs** require an explicit enable option, which the setup below includes. **Application Metrics** need no extra configuration; send them in [step 4](#send-application-metrics-). + +Don't need a feature? Remove its configuration. Remove the `sentry-async-profiler` dependency to disable Profiling. + +The default setup uses the Sentry OpenTelemetry agent. See the [agent setup guide](/platforms/java/opentelemetry/setup/agent/) or [agentless setup guide](/platforms/java/opentelemetry/setup/agentless/) for details. -## Verify + -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. +The following setup initializes the Java SDK without the OpenTelemetry agent. It configures Error Monitoring, Tracing, Profiling, and Logs. Logs are enabled with `logs.enabled=true`; Metrics are available after SDK initialization and have no enable option. - + + + + +## Send Logs + +The Java SDK's structured Logs feature must be enabled in your configuration. The snippets above enable it. Then use `Sentry.logger()` to send logs: - +Use the logger API to send logs at different levels. Add attributes to make logs easier to search and filter. -Learn more about manually capturing an error or message in our Usage documentation. +For framework logging, see the [JUL guide](/platforms/java/guides/jul/), [Log4j2 guide](/platforms/java/guides/log4j2/), and [Logback guide](/platforms/java/guides/logback/). Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). - +See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. +```java +import io.sentry.Sentry; + +Sentry.logger().info("User example action completed"); +Sentry.logger().warn("Slow operation detected"); +Sentry.logger().error("Validation failed"); +``` + +## Send Application Metrics + +Metrics are available after SDK initialization; no additional option is required. Use `Sentry.metrics()` to send counters, gauges, and distributions. Add attributes to filter and group metrics. + +See [Set Up Metrics](/platforms/java/metrics/) for all metric types and configuration options. + +```java +import io.sentry.Sentry; + +Sentry.metrics().count("checkout.failed", 1.0); +Sentry.metrics().gauge("queue_depth", 42.0); +Sentry.metrics().distribution("response_time", 187.5); +``` + +## Verify Your Setup + +Run the following code after initializing the SDK. It captures a test error that you can find in your Sentry project. + + ## Next Steps - Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup + + diff --git a/docs/platforms/java/guides/spring-boot/index.mdx b/docs/platforms/java/guides/spring-boot/index.mdx index fedb5bdefc6e3..e13fff0c9e4fa 100644 --- a/docs/platforms/java/guides/spring-boot/index.mdx +++ b/docs/platforms/java/guides/spring-boot/index.mdx @@ -1,43 +1,83 @@ + + --- title: "Spring Boot" -description: "Learn how to use Sentry's Spring Boot SDK." +description: "Learn how to set up Sentry in your Spring Boot application and capture your first events." sdk: sentry.java.spring-boot --- -On this page, we get you up and running with Sentry's SDK. - -Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. + ## Install -Sentry captures data by using an SDK within your application’s runtime. +Install the Sentry Spring Boot integration: +If you use the plain SDK setup in Configure, skip the agent download and launch command. + ## Configure - +**Error Monitoring** starts when the Spring Boot integration initializes. This guide configures **Tracing** and **Profiling**. **Logs** require an explicit enable option, which the setup below includes. **Application Metrics** need no extra configuration; send them in [step 4](#send-application-metrics-). + +Don't need a feature? Remove its configuration. Remove the `sentry-async-profiler` dependency to disable Profiling. + +The default setup uses the Sentry OpenTelemetry agent. See the [agent setup guide](/platforms/java/opentelemetry/setup/agent/) or [agentless setup guide](/platforms/java/opentelemetry/setup/agentless/) for details. -## Verify + -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. +The following setup initializes Sentry through the Spring Boot integration without the OpenTelemetry agent. It configures Error Monitoring, Tracing, Profiling, and Logs. Logs are enabled with `sentry.logs.enabled=true`; Metrics are available after SDK initialization and have no enable option. - + + + + +## Send Logs + +The Java SDK's structured Logs feature must be enabled in your configuration. The snippets above enable it. Then use `Sentry.logger()` to send logs: - +Use the logger API to send logs at different levels. Add attributes to make logs easier to search and filter. -Learn more about manually capturing an error or message in our Usage documentation. +For framework logging, see the [JUL guide](/platforms/java/guides/jul/), [Log4j2 guide](/platforms/java/guides/log4j2/), and [Logback guide](/platforms/java/guides/logback/). Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). - +See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. +```java +import io.sentry.Sentry; + +Sentry.logger().info("User example action completed"); +Sentry.logger().warn("Slow operation detected"); +Sentry.logger().error("Validation failed"); +``` + +## Send Application Metrics + +Metrics are available after SDK initialization; no additional option is required. Use `Sentry.metrics()` to send counters, gauges, and distributions. Add attributes to filter and group metrics. + +See [Set Up Metrics](/platforms/java/metrics/) for all metric types and configuration options. + +```java +import io.sentry.Sentry; + +Sentry.metrics().count("checkout.failed", 1.0); +Sentry.metrics().gauge("queue_depth", 42.0); +Sentry.metrics().distribution("response_time", 187.5); +``` + +## Verify Your Setup + +Run the following code after initializing the SDK. It captures a test error that you can find in your Sentry project. + + ## Next Steps - Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup + + diff --git a/docs/platforms/java/guides/spring/index.mdx b/docs/platforms/java/guides/spring/index.mdx index 1907d6bcc77ee..f4b6c759d7e1b 100644 --- a/docs/platforms/java/guides/spring/index.mdx +++ b/docs/platforms/java/guides/spring/index.mdx @@ -1,43 +1,83 @@ + + --- title: "Spring" -description: "Learn how to use Sentry's Spring SDK." +description: "Learn how to set up Sentry in your Spring application and capture your first events." sdk: sentry.java.spring --- -On this page, we get you up and running with Sentry's SDK. - -Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. + ## Install -Sentry captures data by using an SDK within your application’s runtime. +Install the Sentry Spring integration: +If you use the plain SDK setup in Configure, skip the agent download and launch command. + ## Configure - +**Error Monitoring** starts when the Spring integration initializes. This guide configures **Tracing** and **Profiling**. **Logs** require an explicit enable option, which the setup below includes. **Application Metrics** need no extra configuration; send them in [step 4](#send-application-metrics-). + +Don't need a feature? Remove its configuration. Remove the `sentry-async-profiler` dependency to disable Profiling. + +The default setup uses the Sentry OpenTelemetry agent. See the [agent setup guide](/platforms/java/opentelemetry/setup/agent/) or [agentless setup guide](/platforms/java/opentelemetry/setup/agentless/) for details. -## Verify + -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. +The following setup initializes Sentry through the Spring integration without the OpenTelemetry agent. It configures Error Monitoring, Tracing, Profiling, and Logs. Logs are enabled with `logs.enabled=true`; Metrics are available after SDK initialization and have no enable option. - + + + + +## Send Logs + +The Java SDK's structured Logs feature must be enabled in your configuration. The snippets above enable it. Then use `Sentry.logger()` to send logs: - +Use the logger API to send logs at different levels. Add attributes to make logs easier to search and filter. -Learn more about manually capturing an error or message in our Usage documentation. +For framework logging, see the [JUL guide](/platforms/java/guides/jul/), [Log4j2 guide](/platforms/java/guides/log4j2/), and [Logback guide](/platforms/java/guides/logback/). Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). - +See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. +```java +import io.sentry.Sentry; + +Sentry.logger().info("User example action completed"); +Sentry.logger().warn("Slow operation detected"); +Sentry.logger().error("Validation failed"); +``` + +## Send Application Metrics + +Metrics are available after SDK initialization; no additional option is required. Use `Sentry.metrics()` to send counters, gauges, and distributions. Add attributes to filter and group metrics. + +See [Set Up Metrics](/platforms/java/metrics/) for all metric types and configuration options. + +```java +import io.sentry.Sentry; + +Sentry.metrics().count("checkout.failed", 1.0); +Sentry.metrics().gauge("queue_depth", 42.0); +Sentry.metrics().distribution("response_time", 187.5); +``` + +## Verify Your Setup + +Run the following code after initializing the SDK. It captures a test error that you can find in your Sentry project. + + ## Next Steps - Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup + + diff --git a/platform-includes/getting-started-config/java.jul.mdx b/platform-includes/getting-started-config/java.jul.mdx index b9fa7348381f3..acba6d23e4178 100644 --- a/platform-includes/getting-started-config/java.jul.mdx +++ b/platform-includes/getting-started-config/java.jul.mdx @@ -27,7 +27,6 @@ When starting your application, add the `java.util.logging.config.file` to the s java -Djava.util.logging.config.file=/path/to/app.properties MyClass ``` - ### DSN Configuration Sentry reads the DSN from the system property `sentry.dsn`, environment variable `SENTRY_DSN` or the `dsn` property in `sentry.properties` file. [See the configuration page](/platforms/java/configuration/) for more details on external configuration. @@ -35,27 +34,23 @@ Sentry reads the DSN from the system property `sentry.dsn`, environment variable ```properties {tabTitle:sentry.properties} dsn=___PUBLIC_DSN___ +traces-sample-rate=1.0 +profile-session-sample-rate=1.0 +profile-lifecycle=TRACE # Use Data Collection defaults but don't collect automatic user information. # https://docs.sentry.io/platforms/java/guides/jul/data-management/data-collected/ data-collection.user-info=false # Configure other data categories here. - # Enable logs logs.enabled=true - ``` - - ### Minimum Log Level Two log levels are used to configure this integration: 1. Configure the lowest level required for a log message to become an event (`minimumEventLevel`) sent to Sentry. 2. Configure the lowest level a message has to be to become a breadcrumb (`minimumBreadcrumbLevel`). - 3. Configure the lowest level a message has to be to be sent as Sentry Log (`minimumLevel`). - - Setting `minimumEventLevel` or `minimumBreadcrumbLevel` in `logging.properties` only affects events logged by way of JUL. The settings will have no effect when calling `Sentry.captureMessage` or similar directly. diff --git a/platform-includes/getting-started-config/java.log4j2.mdx b/platform-includes/getting-started-config/java.log4j2.mdx index 21571683b485f..5d41c0892b363 100644 --- a/platform-includes/getting-started-config/java.log4j2.mdx +++ b/platform-includes/getting-started-config/java.log4j2.mdx @@ -8,7 +8,6 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se - ```xml @@ -29,34 +28,8 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se ``` - - - -```xml - - - - - - - - - - - - - - - - - - -``` - - `SentryAppender` does not support [Log4j's asynchronous loggers](https://logging.apache.org/log4j/2.x/manual/async.html). The Sentry Java SDK itself is already asynchronous and does not perform any blocking operation on the calling thread. - ### DSN Configuration Note that **you need to configure your DSN** (client key) only if you wish to initialize the SDK through the Log4j 2 integration. If you're planning to use `Sentry.init` to provide configuration, such as by using the `beforeSend` callback, you **should not** provide the DSN in both `Sentry.init` and the appender configuration; just leave it out of the appender configuration in this case. @@ -68,26 +41,22 @@ Note that **you need to configure your DSN** (client key) only if you wish to in If the DSN is not present in the `log4j2.xml` configuration, Sentry will attempt to read it from the system property `sentry.dsn`, environment variable `SENTRY_DSN` or the `dsn` property in `sentry.properties` file. [See the configuration page](/platforms/java/configuration/) for more details on external configuration. ```properties {tabTitle:sentry.properties} +traces-sample-rate=1.0 +profile-session-sample-rate=1.0 +profile-lifecycle=TRACE # Use Data Collection defaults but don't collect automatic user information. # https://docs.sentry.io/platforms/java/guides/log4j2/data-management/data-collected/ data-collection.user-info=false # Configure other data categories here. -// ___PRODUCT_OPTION_START___ logs logs.enabled=true -// ___PRODUCT_OPTION_END___ logs ``` - - ### Minimum Log Level Two log levels are used to configure this integration, as illustrated below in the provided code samples: 1. Configure the lowest level required for a log message to become an event (`minimumEventLevel`) sent to Sentry. 2. Configure the lowest level a message has to be to become a breadcrumb (`minimumBreadcrumbLevel`) - 3. Configure the lowest level a message has to be to be sent as Sentry Log (`minimumLevel`). - - Setting `minimumEventLevel` or `minimumBreadcrumbLevel` in `log4j2.xml` only affects events logged by way of Log4j2. The settings will have no effect when calling `Sentry.captureMessage` or similar directly. @@ -96,7 +65,6 @@ Setting `minimumEventLevel` or `minimumBreadcrumbLevel` in `log4j2.xml` only aff Breadcrumbs are kept in memory (by default the last 100 records) and are sent with events. For example, by default, if you log 100 entries with `logger.info` or `logger.warn`, no event is sent to Sentry. If you then log with `logger.error`, an event is sent to Sentry that includes those 100 `info` or `warn` messages. For this to work, `SentryAppender` needs to receive **all** log entries to decide what to keep as breadcrumb or send as event. Set the `SentryAppender` log level configuration to a value lower than what is set for the `minimumBreadcrumbLevel` and `minimumEventLevel` so that `SentryAppender` receives these log messages. - ```xml @@ -104,22 +72,6 @@ Breadcrumbs are kept in memory (by default the last 100 records) and are sent wi dsn="___PUBLIC_DSN___" minimumBreadcrumbLevel="DEBUG" minimumEventLevel="WARN" - - minimumLevel="DEBUG" - - /> -``` - - -```xml - - - minimumLevel="DEBUG" - /> ``` - diff --git a/platform-includes/getting-started-config/java.logback.mdx b/platform-includes/getting-started-config/java.logback.mdx index c68dff686d876..c17a882264c13 100644 --- a/platform-includes/getting-started-config/java.logback.mdx +++ b/platform-includes/getting-started-config/java.logback.mdx @@ -8,7 +8,6 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se - ```xml @@ -21,11 +20,9 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se - // ___PRODUCT_OPTION_START___ logs true - // ___PRODUCT_OPTION_END___ logs @@ -37,38 +34,15 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se ``` - - - -```xml - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - -``` - - - ### SDK Configuration Configure the SDK using a `sentry.properties` file: ```properties {filename:sentry.properties} dsn=___PUBLIC_DSN___ +traces-sample-rate=1.0 +profile-session-sample-rate=1.0 +profile-lifecycle=TRACE # Use Data Collection defaults but don't collect automatic user information. # https://docs.sentry.io/platforms/java/guides/logback/data-management/data-collected/ data-collection.user-info=false @@ -76,18 +50,13 @@ data-collection.user-info=false ``` You can also provide the DSN through the `sentry.dsn` system property or the `SENTRY_DSN` environment variable. [See the configuration page](/platforms/java/configuration/) for more details on external configuration. - - ### Minimum Log Level Two log levels are used to configure this integration: 1. Configure the lowest level required for a log message to become an event (`minimumEventLevel`) sent to Sentry. 2. Configure the lowest level a message has to be to become a breadcrumb (`minimumBreadcrumbLevel`). - 3. Configure the lowest level a message has to be to be sent as Sentry Log (`minimumLevel`). - - Setting `minimumEventLevel` or `minimumBreadcrumbLevel` in `logback.xml` only affects events logged by way of Logback. The settings will have no effect when calling `Sentry.captureMessage` or similar directly. @@ -97,36 +66,16 @@ Setting `minimumEventLevel` or `minimumBreadcrumbLevel` in `logback.xml` only af Breadcrumbs are kept in memory (by default the last 100 records) and are sent with events. For example, by default, if you log 100 entries with `logger.info` or `logger.warn`, no event is sent to Sentry. If you then log with `logger.error`, an event is sent to Sentry which includes those 100 `info` or `warn` messages. For this to work, `SentryAppender` needs to receive **all** log entries to decide what to keep as breadcrumb or sent as event. Set the `SentryAppender` log level configuration to a value lower than what is set for the `minimumBreadcrumbLevel` and `minimumEventLevel` so that `SentryAppender` receives these log messages. - ```xml WARN DEBUG - // ___PRODUCT_OPTION_START___ logs DEBUG - // ___PRODUCT_OPTION_END___ logs ``` - - - -```xml - - - WARN - - DEBUG - // ___PRODUCT_OPTION_START___ logs - - DEBUG - // ___PRODUCT_OPTION_END___ logs - -``` - - ### Encoded Messages A Logback encoder can mask or remove sensitive values before Sentry receives a log entry. When you configure an encoder on `SentryAppender`, Sentry sends the encoded message and omits the original message template and parameters by default. diff --git a/platform-includes/getting-started-config/java.mdx b/platform-includes/getting-started-config/java.mdx index 2acface3c9a9e..ca58cecb3e439 100644 --- a/platform-includes/getting-started-config/java.mdx +++ b/platform-includes/getting-started-config/java.mdx @@ -1,7 +1,7 @@ - Configuration should happen as early as possible in your application's lifecycle. ```java {tabTitle: Java} +import io.sentry.ProfileLifecycle; import io.sentry.Sentry; Sentry.init(options -> { @@ -12,28 +12,23 @@ Sentry.init(options -> { options.getDataCollection().forceDataCollection(); options.getDataCollection().setUserInfo(false); // Configure other data categories here. - // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production. options.setTracesSampleRate(1.0); - // ___PRODUCT_OPTION_END___ performance - // ___PRODUCT_OPTION_START___ profiling // Enable profiling options.setProfileSessionSampleRate(1.0); options.setProfileLifecycle(ProfileLifecycle.TRACE); - // ___PRODUCT_OPTION_END___ profiling - // ___PRODUCT_OPTION_START___ logs // Enable logs to be sent to Sentry options.getLogs().setEnabled(true); - // ___PRODUCT_OPTION_END___ logs }); ``` ```kotlin {tabTitle: Kotlin} +import io.sentry.ProfileLifecycle import io.sentry.Sentry Sentry.init { options -> @@ -44,32 +39,23 @@ Sentry.init { options -> options.dataCollection.forceDataCollection() options.dataCollection.userInfo = false // Configure other data categories here. - // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0 - // ___PRODUCT_OPTION_END___ performance - // ___PRODUCT_OPTION_START___ profiling // Enable profiling options.profileSessionSampleRate = 1.0 options.profileLifecycle = ProfileLifecycle.TRACE - // ___PRODUCT_OPTION_END___ profiling - // ___PRODUCT_OPTION_START___ logs // Enable logs to be sent to Sentry options.logs.enabled = true - // ___PRODUCT_OPTION_END___ logs } ``` - -Learn more about setting up logging in our Logs documentation. +Learn more about setting up logging in our [Logs documentation](/platforms/java/logs/). - - diff --git a/platform-includes/getting-started-config/java.servlet.mdx b/platform-includes/getting-started-config/java.servlet.mdx index cbcc3debdb2e1..74010d71c582a 100644 --- a/platform-includes/getting-started-config/java.servlet.mdx +++ b/platform-includes/getting-started-config/java.servlet.mdx @@ -1,4 +1,3 @@ - Configuration should happen as early as possible in your application's lifecycle. The following example configures a `SentryInitializer` servlet container initializer that initializes Sentry on application startup. @@ -6,6 +5,7 @@ The following example configures a `SentryInitializer` servlet container initial ```java package sentry.sample; +import io.sentry.ProfileLifecycle; import io.sentry.Sentry; import javax.servlet.ServletContainerInitializer; import javax.servlet.ServletContext; @@ -23,24 +23,18 @@ public final class SentryInitializer implements ServletContainerInitializer { options.getDataCollection().forceDataCollection(); options.getDataCollection().setUserInfo(false); // Configure other data categories here. - // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production. options.setTracesSampleRate(1.0); - // ___PRODUCT_OPTION_END___ performance - // ___PRODUCT_OPTION_START___ profiling // Enable profiling options.setProfileSessionSampleRate(1.0); options.setProfileLifecycle(ProfileLifecycle.TRACE); - // ___PRODUCT_OPTION_END___ profiling - // ___PRODUCT_OPTION_START___ logs // Enable logs to be sent to Sentry options.getLogs().setEnabled(true); - // ___PRODUCT_OPTION_END___ logs }); } } @@ -64,41 +58,30 @@ class SentryInitializer : ServletContainerInitializer { options.dataCollection.forceDataCollection() options.dataCollection.userInfo = false // Configure other data categories here. - // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0 - // ___PRODUCT_OPTION_END___ performance - // ___PRODUCT_OPTION_START___ profiling // Enable profiling options.profileSessionSampleRate = 1.0 options.profileLifecycle = ProfileLifecycle.TRACE - // ___PRODUCT_OPTION_END___ profiling - // ___PRODUCT_OPTION_START___ logs // Enable logs to be sent to Sentry options.logs.enabled = true - // ___PRODUCT_OPTION_END___ logs } } } ``` - -Learn more about setting up logging in our Logs documentation. +Learn more about setting up logging in our [Logs documentation](/platforms/java/logs/). - - Create a file in `src/main/resources/META-INF/services` named `javax.servlet.ServletContainerInitializer`, with a full name of your custom `SentryInitializer` class as a content: ```properties sentry.sample.SentryInitializer ``` - - diff --git a/platform-includes/getting-started-config/java.spring-boot.mdx b/platform-includes/getting-started-config/java.spring-boot.mdx index 83df69f0e8d54..394d9bdc4fdfa 100644 --- a/platform-includes/getting-started-config/java.spring-boot.mdx +++ b/platform-includes/getting-started-config/java.spring-boot.mdx @@ -10,24 +10,18 @@ sentry.dsn=___PUBLIC_DSN___ # https://docs.sentry.io/platforms/java/guides/spring-boot/data-management/data-collected/ sentry.data-collection.user-info=false # Configure other data categories here. -# ___PRODUCT_OPTION_START___ performance # Set traces_sample_rate to 1.0 to capture 100% # of transactions for tracing. # We recommend adjusting this value in production. sentry.traces-sample-rate=1.0 -# ___PRODUCT_OPTION_END___ performance -// ___PRODUCT_OPTION_START___ profiling # Enable profiling sentry.profile-session-sample-rate=1.0 sentry.profile-lifecycle=TRACE -// ___PRODUCT_OPTION_END___ profiling -// ___PRODUCT_OPTION_START___ logs # Enable logs sentry.logs.enabled=true -// ___PRODUCT_OPTION_END___ logs ``` ```yaml {filename:application.yml} @@ -39,25 +33,19 @@ sentry: data-collection: user-info: false # Configure other data categories here. - # ___PRODUCT_OPTION_START___ performance # Set traces_sample_rate to 1.0 to capture 100% # of transactions for tracing. # We recommend adjusting this value in production. tracesSampleRate: 1.0 - # ___PRODUCT_OPTION_END___ performance - // ___PRODUCT_OPTION_START___ profiling # Enable profiling profileSessionSampleRate: 1.0 profileLifecycle: TRACE - // ___PRODUCT_OPTION_END___ profiling - // ___PRODUCT_OPTION_START___ logs # Enable logs logs: enabled: true - // ___PRODUCT_OPTION_END___ logs ``` By default, only unhandled exceptions are sent to Sentry. This behavior can be tuned through configuring the `sentry.exception-resolver-order` property. For example, setting it to `-2147483647` (the value of `org.springframework.core.Ordered#HIGHEST_PRECEDENCE`) ensures exceptions that have been handled by exception resolvers with higher order are sent to Sentry - including ones handled by `@ExceptionHandler` annotated methods. @@ -71,6 +59,6 @@ sentry: exception-resolver-order: -2147483647 ``` -We recommend using Sentry's Spring Boot integration with one of the [logging framework integrations](logging-frameworks/) as they work together seamlessly. To use Sentry **without** Spring Boot, we recommend using the [Sentry Spring integration](/platforms/java/guides/spring/). +We recommend using Sentry's Spring Boot integration with one of the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/) as they work together seamlessly. To use Sentry **without** Spring Boot, we recommend using the [Sentry Spring integration](/platforms/java/guides/spring/). -Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](usage/), to record breadcrumbs, set the current user, or manually send events, for example. +Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](/platforms/java/usage/), to record breadcrumbs, set the current user, or manually send events, for example. diff --git a/platform-includes/getting-started-config/java.spring.mdx b/platform-includes/getting-started-config/java.spring.mdx index b0682f6a21e83..886f6bc71510e 100644 --- a/platform-includes/getting-started-config/java.spring.mdx +++ b/platform-includes/getting-started-config/java.spring.mdx @@ -82,7 +82,7 @@ data-collection.user-info=false The DSN can be also provided through the system property `sentry.dsn`, environment variable `SENTRY_DSN` or the `dsn` property in `sentry.properties` file. [See the configuration page](/platforms/java/configuration/) for more details on external configuration. -Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](usage/), to record breadcrumbs, set the current user, or manually send events, for example. +Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](/platforms/java/usage/), to record breadcrumbs, set the current user, or manually send events, for example. By default, only unhandled exceptions are sent to Sentry. This behavior can be tuned through configuring the `exceptionResolverOrder` property. For example, setting it to `Ordered#HIGHEST_PRECEDENCE` ensures exceptions that have been handled by exception resolvers with higher order are sent to Sentry - including ones handled by `@ExceptionHandler` annotated methods. @@ -166,17 +166,11 @@ class SentryConfiguration The SDK can be configured using a `sentry.properties` file: ```properties {filename:sentry.properties} -// ___PRODUCT_OPTION_START___ performance # Enable tracing traces-sample-rate=1.0 -// ___PRODUCT_OPTION_END___ performance -// ___PRODUCT_OPTION_START___ profiling # Enable profiling profile-session-sample-rate=1.0 profile-lifecycle=TRACE -// ___PRODUCT_OPTION_END___ profiling -// ___PRODUCT_OPTION_START___ logs # Enable logs logs.enabled=true -// ___PRODUCT_OPTION_END___ logs ``` diff --git a/platform-includes/getting-started-config/opentelemetry/java.mdx b/platform-includes/getting-started-config/opentelemetry/java.mdx index 083b36ef8c2eb..e4afd0e600611 100644 --- a/platform-includes/getting-started-config/opentelemetry/java.mdx +++ b/platform-includes/getting-started-config/opentelemetry/java.mdx @@ -1,5 +1,3 @@ - - The SDK can be configured using a `sentry.properties` file: ```properties {filename:sentry.properties} @@ -8,25 +6,16 @@ dsn=___PUBLIC_DSN___ # https://docs.sentry.io/platforms/java/data-management/data-collected/ data-collection.user-info=false # Configure other data categories here. -# ___PRODUCT_OPTION_START___ performance traces-sample-rate=1.0 -# ___PRODUCT_OPTION_END___ performance -// ___PRODUCT_OPTION_START___ logs logs.enabled=true -// ___PRODUCT_OPTION_END___ logs -// ___PRODUCT_OPTION_START___ profiling # Enable profiling profile-session-sample-rate=1.0 profile-lifecycle=TRACE -// ___PRODUCT_OPTION_END___ profiling ``` - -Learn more about setting up logging in our Logs documentation. +Learn more about setting up logging in our [Logs documentation](/platforms/java/logs/). - - diff --git a/platform-includes/getting-started-config/opentelemetry/java.spring-boot.mdx b/platform-includes/getting-started-config/opentelemetry/java.spring-boot.mdx index e69de29bb2d1d..4f2982a9acb8b 100644 --- a/platform-includes/getting-started-config/opentelemetry/java.spring-boot.mdx +++ b/platform-includes/getting-started-config/opentelemetry/java.spring-boot.mdx @@ -0,0 +1,19 @@ +The Spring Boot integration initializes the SDK when the OpenTelemetry agent is installed. Set the DSN and feature options in `application.properties` or `application.yml`: + +```properties {filename:application.properties} +sentry.dsn=___PUBLIC_DSN___ +sentry.traces-sample-rate=1.0 +sentry.profile-session-sample-rate=1.0 +sentry.profile-lifecycle=TRACE +sentry.logs.enabled=true +``` + +```yaml {filename:application.yml} +sentry: + dsn: ___PUBLIC_DSN___ + traces-sample-rate: 1.0 + profile-session-sample-rate: 1.0 + profile-lifecycle: TRACE + logs: + enabled: true +``` diff --git a/platform-includes/getting-started-config/opentelemetry/java.spring.mdx b/platform-includes/getting-started-config/opentelemetry/java.spring.mdx index e69de29bb2d1d..ec259dbfa542e 100644 --- a/platform-includes/getting-started-config/opentelemetry/java.spring.mdx +++ b/platform-includes/getting-started-config/opentelemetry/java.spring.mdx @@ -0,0 +1,34 @@ +The Spring integration initializes the SDK and the OpenTelemetry agent provides automatic instrumentation. Add `@EnableSentry` to a Spring configuration class and set the DSN: + +```java {tabTitle: Spring 5} +import io.sentry.spring.EnableSentry; + +@EnableSentry(dsn = "___PUBLIC_DSN___") +@Configuration +class SentryConfiguration {} +``` + +```java {tabTitle: Spring 6} +import io.sentry.spring.jakarta.EnableSentry; + +@EnableSentry(dsn = "___PUBLIC_DSN___") +@Configuration +class SentryConfiguration {} +``` + +```java {tabTitle: Spring 7} +import io.sentry.spring7.EnableSentry; + +@EnableSentry(dsn = "___PUBLIC_DSN___") +@Configuration +class SentryConfiguration {} +``` + +Configure Tracing, Profiling, and Logs in `sentry.properties`: + +```properties {filename:sentry.properties} +traces-sample-rate=1.0 +profile-session-sample-rate=1.0 +profile-lifecycle=TRACE +logs.enabled=true +``` diff --git a/platform-includes/getting-started-install/java.jul.mdx b/platform-includes/getting-started-install/java.jul.mdx index a2cec0276dc41..d4075c0830dbf 100644 --- a/platform-includes/getting-started-install/java.jul.mdx +++ b/platform-includes/getting-started-install/java.jul.mdx @@ -1,34 +1,24 @@ - - ```xml {tabTitle:Maven} io.sentry sentry-jul {{@inject packages.version('sentry.java.jul', '4.1.0') }} -// ___PRODUCT_OPTION_START___ profiling io.sentry sentry-async-profiler {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle} implementation 'io.sentry:sentry-jul:{{@inject packages.version('sentry.java.jul', '4.1.0') }}' -// ___PRODUCT_OPTION_START___ profiling implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -// ___PRODUCT_OPTION_END___ profiling ``` ```scala {tabTitle: SBT} libraryDependencies += "io.sentry" % "sentry-jul" % "{{@inject packages.version('sentry.java.jul', '4.1.0') }}" -// ___PRODUCT_OPTION_START___ profiling libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" -// ___PRODUCT_OPTION_END___ profiling ``` For other dependency managers, see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-jul). diff --git a/platform-includes/getting-started-install/java.log4j2.mdx b/platform-includes/getting-started-install/java.log4j2.mdx index fbb0dfc39c208..0671cc9e37596 100644 --- a/platform-includes/getting-started-install/java.log4j2.mdx +++ b/platform-includes/getting-started-install/java.log4j2.mdx @@ -1,7 +1,3 @@ - - ```xml {tabTitle:Maven Plugin} {mdExpandTabs} {filename:pom.xml} io.sentry @@ -35,7 +31,6 @@ -// ___PRODUCT_OPTION_START___ profiling io.sentry @@ -43,7 +38,6 @@ {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven} @@ -52,38 +46,30 @@ sentry-log4j2 {{@inject packages.version('sentry.java.log4j2', '4.2.0') }} -// ___PRODUCT_OPTION_START___ profiling io.sentry sentry-async-profiler {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle Plugin} plugins { id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" } -// ___PRODUCT_OPTION_START___ profiling dependencies { implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' } -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle} implementation 'io.sentry:sentry-log4j2:{{@inject packages.version('sentry.java.log4j2', '4.2.0') }}' -// ___PRODUCT_OPTION_START___ profiling implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -// ___PRODUCT_OPTION_END___ profiling ``` ```scala {tabTitle: SBT} libraryDependencies += "io.sentry" % "sentry-log4j2" % "{{@inject packages.version('sentry.java.log4j2', '4.2.0') }}" -// ___PRODUCT_OPTION_START___ profiling libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" -// ___PRODUCT_OPTION_END___ profiling ``` For other dependency managers see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-log4j2). diff --git a/platform-includes/getting-started-install/java.logback.mdx b/platform-includes/getting-started-install/java.logback.mdx index 31705e9832079..b7c24fe52049f 100644 --- a/platform-includes/getting-started-install/java.logback.mdx +++ b/platform-includes/getting-started-install/java.logback.mdx @@ -1,7 +1,3 @@ - - ```xml {tabTitle:Maven Plugin} {mdExpandTabs} {filename:pom.xml} io.sentry @@ -35,7 +31,6 @@ -// ___PRODUCT_OPTION_START___ profiling io.sentry @@ -43,7 +38,6 @@ {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven} @@ -52,38 +46,30 @@ sentry-logback {{@inject packages.version('sentry.java.logback', '4.2.0') }} -// ___PRODUCT_OPTION_START___ profiling io.sentry sentry-async-profiler {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle Plugin} plugins { id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" } -// ___PRODUCT_OPTION_START___ profiling dependencies { implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' } -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle} implementation 'io.sentry:sentry-logback:{{@inject packages.version('sentry.java.logback', '4.2.0') }}' -// ___PRODUCT_OPTION_START___ profiling implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -// ___PRODUCT_OPTION_END___ profiling ``` ```scala {tabTitle: SBT} libraryDependencies += "io.sentry" % "sentry-logback" % "{{@inject packages.version('sentry.java.logback', '4.2.0') }}" -// ___PRODUCT_OPTION_START___ profiling libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" -// ___PRODUCT_OPTION_END___ profiling ``` For other dependency managers, see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-logback). diff --git a/platform-includes/getting-started-install/java.mdx b/platform-includes/getting-started-install/java.mdx index 201b8149f6206..5dcbaf675302a 100644 --- a/platform-includes/getting-started-install/java.mdx +++ b/platform-includes/getting-started-install/java.mdx @@ -1,16 +1,10 @@ - - ```groovy {filename:build.gradle} plugins { id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" } -// ___PRODUCT_OPTION_START___ profiling dependencies { implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' } -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven Plugin} {mdExpandTabs} {filename:pom.xml} @@ -46,7 +40,6 @@ dependencies { -// ___PRODUCT_OPTION_START___ profiling io.sentry @@ -54,14 +47,11 @@ dependencies { {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```scala {tabTitle:SBT} libraryDependencies += "io.sentry" % "sentry" % "{{@inject packages.version('sentry.java', '4.2.0') }}" -// ___PRODUCT_OPTION_START___ profiling libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" -// ___PRODUCT_OPTION_END___ profiling ``` diff --git a/platform-includes/getting-started-install/java.servlet.mdx b/platform-includes/getting-started-install/java.servlet.mdx index aa1a1bb4f3816..b15903f9038ea 100644 --- a/platform-includes/getting-started-install/java.servlet.mdx +++ b/platform-includes/getting-started-install/java.servlet.mdx @@ -1,34 +1,24 @@ - - ```xml {tabTitle:Maven} io.sentry sentry-servlet {{@inject packages.version('sentry.java.servlet', '4.1.0') }} -// ___PRODUCT_OPTION_START___ profiling io.sentry sentry-async-profiler {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle} implementation 'io.sentry:sentry-servlet:{{@inject packages.version('sentry.java.servlet', '4.1.0') }}' -// ___PRODUCT_OPTION_START___ profiling implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -// ___PRODUCT_OPTION_END___ profiling ``` ```scala {tabTitle: SBT} libraryDependencies += "io.sentry" % "sentry-servlet" % "{{@inject packages.version('sentry.java.servlet', '4.1.0') }}" -// ___PRODUCT_OPTION_START___ profiling libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" -// ___PRODUCT_OPTION_END___ profiling ``` For other dependency managers, see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-servlet). diff --git a/platform-includes/getting-started-install/java.spring-boot.mdx b/platform-includes/getting-started-install/java.spring-boot.mdx index 929700cdb29d4..7bc1278923fd1 100644 --- a/platform-includes/getting-started-install/java.spring-boot.mdx +++ b/platform-includes/getting-started-install/java.spring-boot.mdx @@ -1,16 +1,10 @@ - - ```groovy {tabTitle:Gradle Plugin} {mdExpandTabs} plugins { id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" } -// ___PRODUCT_OPTION_START___ profiling dependencies { implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' } -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven Plugin}{filename:pom.xml} @@ -46,7 +40,6 @@ dependencies { -// ___PRODUCT_OPTION_START___ profiling io.sentry @@ -54,28 +47,21 @@ dependencies { {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle (Spring Boot 2)} implementation 'io.sentry:sentry-spring-boot-starter:{{@inject packages.version('sentry.java.spring-boot', '4.2.0') }}' -// ___PRODUCT_OPTION_START___ profiling implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle (Spring Boot 3)} implementation 'io.sentry:sentry-spring-boot-starter-jakarta:{{@inject packages.version('sentry.java.spring-boot.jakarta', '6.7.0') }}' -// ___PRODUCT_OPTION_START___ profiling implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle (Spring Boot 4)} implementation 'io.sentry:sentry-spring-boot-4:{{@inject packages.version('sentry.java.spring-boot-4', '8.15.1') }}' -// ___PRODUCT_OPTION_START___ profiling implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven (Spring Boot 2)} @@ -84,13 +70,11 @@ implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sent sentry-spring-boot-starter {{@inject packages.version('sentry.java.spring-boot', '4.2.0') }} -// ___PRODUCT_OPTION_START___ profiling io.sentry sentry-async-profiler {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven (Spring Boot 3)} @@ -99,13 +83,11 @@ implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sent sentry-spring-boot-starter-jakarta {{@inject packages.version('sentry.java.spring-boot.jakarta', '6.7.0') }} -// ___PRODUCT_OPTION_START___ profiling io.sentry sentry-async-profiler {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven (Spring Boot 4)} @@ -114,13 +96,11 @@ implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sent sentry-spring-boot-4 {{@inject packages.version('sentry.java.spring-boot-4', '8.15.1') }} -// ___PRODUCT_OPTION_START___ profiling io.sentry sentry-async-profiler {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` diff --git a/platform-includes/getting-started-install/java.spring.mdx b/platform-includes/getting-started-install/java.spring.mdx index 2260c460a971f..517cd5189c6a2 100644 --- a/platform-includes/getting-started-install/java.spring.mdx +++ b/platform-includes/getting-started-install/java.spring.mdx @@ -1,16 +1,10 @@ - - ```groovy {tabTitle:Gradle Plugin} {mdExpandTabs} plugins { id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" } -// ___PRODUCT_OPTION_START___ profiling dependencies { implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' } -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven Plugin}{filename:pom.xml} @@ -46,7 +40,6 @@ dependencies { -// ___PRODUCT_OPTION_START___ profiling io.sentry @@ -54,28 +47,21 @@ dependencies { {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle (Spring 5)} implementation 'io.sentry:sentry-spring:{{@inject packages.version('sentry.java.spring', '4.2.0') }}' -// ___PRODUCT_OPTION_START___ profiling implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle (Spring 6)} implementation 'io.sentry:sentry-spring-jakarta:{{@inject packages.version('sentry.java.spring.jakarta', '6.7.0') }}' -// ___PRODUCT_OPTION_START___ profiling implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -// ___PRODUCT_OPTION_END___ profiling ``` ```groovy {tabTitle:Gradle (Spring 7)} implementation 'io.sentry:sentry-spring-7:{{@inject packages.version('sentry.java.spring-7', '8.15.1') }}' -// ___PRODUCT_OPTION_START___ profiling implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven (Spring 5)} @@ -84,13 +70,11 @@ implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sent sentry-spring {{@inject packages.version('sentry.java.spring', '4.2.0') }} -// ___PRODUCT_OPTION_START___ profiling io.sentry sentry-async-profiler {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven (Spring 6)} @@ -99,13 +83,11 @@ implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sent sentry-spring-jakarta {{@inject packages.version('sentry.java.spring.jakarta', '6.7.0') }} -// ___PRODUCT_OPTION_START___ profiling io.sentry sentry-async-profiler {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```xml {tabTitle:Maven (Spring 7)} @@ -114,34 +96,26 @@ implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sent sentry-spring-7 {{@inject packages.version('sentry.java.spring-7', '8.15.1') }} -// ___PRODUCT_OPTION_START___ profiling io.sentry sentry-async-profiler {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} -// ___PRODUCT_OPTION_END___ profiling ``` ```scala {tabTitle: SBT (Spring 5)} libraryDependencies += "io.sentry" % "sentry-spring" % "{{@inject packages.version('sentry.java.spring', '4.2.0') }}" -// ___PRODUCT_OPTION_START___ profiling libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" -// ___PRODUCT_OPTION_END___ profiling ``` ```scala {tabTitle: SBT (Spring 6)} libraryDependencies += "io.sentry" % "sentry-spring-jakarta" % "{{@inject packages.version('sentry.java.spring.jakarta', '6.7.0') }}" -// ___PRODUCT_OPTION_START___ profiling libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" -// ___PRODUCT_OPTION_END___ profiling ``` ```scala {tabTitle: SBT (Spring 7)} libraryDependencies += "io.sentry" % "sentry-spring-7" % "{{@inject packages.version('sentry.java.spring-7', '8.15.1') }}" -// ___PRODUCT_OPTION_START___ profiling libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" -// ___PRODUCT_OPTION_END___ profiling ``` For other dependency managers see the [central Maven repository (Spring 5)](https://search.maven.org/artifact/io.sentry/sentry-spring), [central Maven repository (Spring 6)](https://search.maven.org/artifact/io.sentry/sentry-spring-jakarta), and [central Maven repository (Spring 7)](https://search.maven.org/artifact/io.sentry/sentry-spring-7). diff --git a/platform-includes/getting-started-install/opentelemetry/java.mdx b/platform-includes/getting-started-install/opentelemetry/java.mdx index 1e625d64d6535..0c4c1e963e4c4 100644 --- a/platform-includes/getting-started-install/opentelemetry/java.mdx +++ b/platform-includes/getting-started-install/opentelemetry/java.mdx @@ -1,4 +1,3 @@ - When running your application, please add our `sentry-opentelemetry-agent` to the `java` command. Download the latest version of the `sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar` from [MavenCentral](https://search.maven.org/artifact/io.sentry/sentry-opentelemetry-agent): @@ -14,4 +13,3 @@ SENTRY_PROPERTIES_FILE=sentry.properties JAVA_TOOL_OPTIONS="-javaagent:sentry-op ```bash {tabTitle: Java CLI argument} SENTRY_PROPERTIES_FILE=sentry.properties java -javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -jar your-application.jar ``` - diff --git a/platform-includes/getting-started-install/opentelemetry/java.spring-boot.mdx b/platform-includes/getting-started-install/opentelemetry/java.spring-boot.mdx index 1c6c8205d0f96..a3fc2d88c4a89 100644 --- a/platform-includes/getting-started-install/opentelemetry/java.spring-boot.mdx +++ b/platform-includes/getting-started-install/opentelemetry/java.spring-boot.mdx @@ -1,4 +1,3 @@ - When running your application, please add our `sentry-opentelemetry-agent` to the `java` command. Download the latest version of the `sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar` from [MavenCentral](https://search.maven.org/artifact/io.sentry/sentry-opentelemetry-agent): @@ -15,4 +14,3 @@ SENTRY_AUTO_INIT=false JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent- ```bash {tabTitle: Java CLI argument} SENTRY_AUTO_INIT=false java -javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -jar your-application.jar ``` - diff --git a/platform-includes/getting-started-install/opentelemetry/java.spring.mdx b/platform-includes/getting-started-install/opentelemetry/java.spring.mdx index 47bdf895ee087..05a12ce3741c1 100644 --- a/platform-includes/getting-started-install/opentelemetry/java.spring.mdx +++ b/platform-includes/getting-started-install/opentelemetry/java.spring.mdx @@ -1,4 +1,3 @@ - When running your application, please add our `sentry-opentelemetry-agent` to the `java` command. In case you are using an application server to run your `.WAR` file, please add it to the `JAVA_OPTS` of your application server. @@ -24,4 +23,3 @@ JAVA_OPTS="${JAVA_OPTS} JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent ```bash {tabTitle: Java CLI argument} JAVA_OPTS="${JAVA_OPTS} JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" ``` - diff --git a/platform-includes/getting-started-primer/java.jul.mdx b/platform-includes/getting-started-primer/java.jul.mdx index 91a706a0ef571..2f2e401b92d3b 100644 --- a/platform-includes/getting-started-primer/java.jul.mdx +++ b/platform-includes/getting-started-primer/java.jul.mdx @@ -10,4 +10,4 @@ The `sentry-jul` library provides a [java.util.logging Handler](http://docs.orac -Once this integration is configured you can _also_ use Sentry’s static API, as shown on the usage page, in order to do things like record breadcrumbs, set the current user, or manually send events. The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-jul). +Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](/platforms/java/usage/), in order to do things like record breadcrumbs, set the current user, or manually send events. The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-jul). diff --git a/platform-includes/getting-started-primer/java.log4j2.mdx b/platform-includes/getting-started-primer/java.log4j2.mdx index fe7c90d61d521..16eea7f3c98a8 100644 --- a/platform-includes/getting-started-primer/java.log4j2.mdx +++ b/platform-includes/getting-started-primer/java.log4j2.mdx @@ -10,4 +10,4 @@ The `sentry-log4j2` library provides [Log4j 2.x](https://logging.apache.org/log4 -Once the integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](usage/), in order to do things like record breadcrumbs, set the current user, or manually send events. The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-log4j2). +Once the integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](/platforms/java/usage/), in order to do things like record breadcrumbs, set the current user, or manually send events. The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-log4j2). diff --git a/platform-includes/getting-started-primer/java.logback.mdx b/platform-includes/getting-started-primer/java.logback.mdx index 63d27a958be47..649a73fcef843 100644 --- a/platform-includes/getting-started-primer/java.logback.mdx +++ b/platform-includes/getting-started-primer/java.logback.mdx @@ -10,4 +10,4 @@ The `sentry-logback` library provides [Logback](https://logback.qos.ch/) support -Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](usage/), in order to do things like record breadcrumbs, set the current user, or manually send events. The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-logback). +Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](/platforms/java/usage/), in order to do things like record breadcrumbs, set the current user, or manually send events. The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-logback). From 688c964b4b5513322d1ebd0d401f2a30967d2add Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Thu, 15 Oct 2026 01:05:22 +0000 Subject: [PATCH 2/7] fix(docs): Restore frontmatter and tidy Send Logs in Java quick starts The Spring and Spring Boot pages had an include placed above the frontmatter, and no Java prerequisites include exists. Also put the Send Logs snippet before the integration links. Co-Authored-By: Shannon Anahata --- docs/platforms/java/common/index.mdx | 14 +++++--------- docs/platforms/java/guides/spring-boot/index.mdx | 14 +++++--------- docs/platforms/java/guides/spring/index.mdx | 14 +++++--------- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/docs/platforms/java/common/index.mdx b/docs/platforms/java/common/index.mdx index b926c5722c7e5..574759684f532 100644 --- a/docs/platforms/java/common/index.mdx +++ b/docs/platforms/java/common/index.mdx @@ -1,5 +1,3 @@ - - @@ -34,13 +32,7 @@ The following setup initializes the Java SDK without the OpenTelemetry agent. It ## Send Logs -The Java SDK's structured Logs feature must be enabled in your configuration. The snippets above enable it. Then use `Sentry.logger()` to send logs: - -Use the logger API to send logs at different levels. Add attributes to make logs easier to search and filter. - -For framework logging, see the [JUL guide](/platforms/java/guides/jul/), [Log4j2 guide](/platforms/java/guides/log4j2/), and [Logback guide](/platforms/java/guides/logback/). Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). - -See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. +Logs must be enabled in your configuration; the snippets in Configure already do this. Use `Sentry.logger()` to send logs at different levels: ```java import io.sentry.Sentry; @@ -50,6 +42,10 @@ Sentry.logger().warn("Slow operation detected"); Sentry.logger().error("Validation failed"); ``` +If you already log with JUL, Log4j2, or Logback, see the [JUL](/platforms/java/guides/jul/), [Log4j2](/platforms/java/guides/log4j2/), and [Logback](/platforms/java/guides/logback/) guides to send those logs to Sentry. Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). + +See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. + ## Send Application Metrics Metrics are available after SDK initialization; no additional option is required. Use `Sentry.metrics()` to send counters, gauges, and distributions. Add attributes to filter and group metrics. diff --git a/docs/platforms/java/guides/spring-boot/index.mdx b/docs/platforms/java/guides/spring-boot/index.mdx index e13fff0c9e4fa..c80f6f6d0c8bf 100644 --- a/docs/platforms/java/guides/spring-boot/index.mdx +++ b/docs/platforms/java/guides/spring-boot/index.mdx @@ -1,5 +1,3 @@ - - --- title: "Spring Boot" description: "Learn how to set up Sentry in your Spring Boot application and capture your first events." @@ -40,13 +38,7 @@ The following setup initializes Sentry through the Spring Boot integration witho ## Send Logs -The Java SDK's structured Logs feature must be enabled in your configuration. The snippets above enable it. Then use `Sentry.logger()` to send logs: - -Use the logger API to send logs at different levels. Add attributes to make logs easier to search and filter. - -For framework logging, see the [JUL guide](/platforms/java/guides/jul/), [Log4j2 guide](/platforms/java/guides/log4j2/), and [Logback guide](/platforms/java/guides/logback/). Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). - -See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. +Logs must be enabled in your configuration; the snippets in Configure already do this. Use `Sentry.logger()` to send logs at different levels: ```java import io.sentry.Sentry; @@ -56,6 +48,10 @@ Sentry.logger().warn("Slow operation detected"); Sentry.logger().error("Validation failed"); ``` +If you already log with JUL, Log4j2, or Logback, see the [JUL](/platforms/java/guides/jul/), [Log4j2](/platforms/java/guides/log4j2/), and [Logback](/platforms/java/guides/logback/) guides to send those logs to Sentry. Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). + +See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. + ## Send Application Metrics Metrics are available after SDK initialization; no additional option is required. Use `Sentry.metrics()` to send counters, gauges, and distributions. Add attributes to filter and group metrics. diff --git a/docs/platforms/java/guides/spring/index.mdx b/docs/platforms/java/guides/spring/index.mdx index f4b6c759d7e1b..534e8f67c9227 100644 --- a/docs/platforms/java/guides/spring/index.mdx +++ b/docs/platforms/java/guides/spring/index.mdx @@ -1,5 +1,3 @@ - - --- title: "Spring" description: "Learn how to set up Sentry in your Spring application and capture your first events." @@ -40,13 +38,7 @@ The following setup initializes Sentry through the Spring integration without th ## Send Logs -The Java SDK's structured Logs feature must be enabled in your configuration. The snippets above enable it. Then use `Sentry.logger()` to send logs: - -Use the logger API to send logs at different levels. Add attributes to make logs easier to search and filter. - -For framework logging, see the [JUL guide](/platforms/java/guides/jul/), [Log4j2 guide](/platforms/java/guides/log4j2/), and [Logback guide](/platforms/java/guides/logback/). Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). - -See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. +Logs must be enabled in your configuration; the snippets in Configure already do this. Use `Sentry.logger()` to send logs at different levels: ```java import io.sentry.Sentry; @@ -56,6 +48,10 @@ Sentry.logger().warn("Slow operation detected"); Sentry.logger().error("Validation failed"); ``` +If you already log with JUL, Log4j2, or Logback, see the [JUL](/platforms/java/guides/jul/), [Log4j2](/platforms/java/guides/log4j2/), and [Logback](/platforms/java/guides/logback/) guides to send those logs to Sentry. Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). + +See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. + ## Send Application Metrics Metrics are available after SDK initialization; no additional option is required. Use `Sentry.metrics()` to send counters, gauges, and distributions. Add attributes to filter and group metrics. From 838be9b275b9a748b1044edf7019f97e08bc404f Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:50:56 +0000 Subject: [PATCH 3/7] fix(docs): Update broken Logback Appender link --- platform-includes/getting-started-primer/java.logback.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-includes/getting-started-primer/java.logback.mdx b/platform-includes/getting-started-primer/java.logback.mdx index 649a73fcef843..e078695116382 100644 --- a/platform-includes/getting-started-primer/java.logback.mdx +++ b/platform-includes/getting-started-primer/java.logback.mdx @@ -1,6 +1,6 @@ -The `sentry-logback` library provides [Logback](https://logback.qos.ch/) support for Sentry using an [Appender](https://logback.qos.ch/apidocs/ch/qos/logback/core/Appender.html) that sends logged exceptions to Sentry. +The `sentry-logback` library provides [Logback](https://logback.qos.ch/) support for Sentry using an [Appender](https://logback.qos.ch/manual/appenders.html) that sends logged exceptions to Sentry. From c8c9f8ba1715d21ea6df41daa9a0e590fc71bb3f Mon Sep 17 00:00:00 2001 From: inventarSarah Date: Thu, 5 Nov 2026 13:46:45 +0100 Subject: [PATCH 4/7] update java and logging integrations --- docs/platforms/java/common/index.mdx | 64 +++++++++--------- docs/platforms/java/config.yml | 1 + docs/platforms/java/guides/jul/config.yml | 1 + docs/platforms/java/guides/jul/index.mdx | 47 +++++++++++++ docs/platforms/java/guides/log4j2/config.yml | 1 + docs/platforms/java/guides/log4j2/index.mdx | 47 +++++++++++++ docs/platforms/java/guides/logback/config.yml | 1 + docs/platforms/java/guides/logback/index.mdx | 47 +++++++++++++ includes/quick-start-features-expandable.mdx | 2 +- .../quick-start-locate-data-expandable.mdx | 2 +- .../getting-started-config/java.jul.mdx | 18 ++--- .../getting-started-config/java.log4j2.mdx | 67 ++++++++++++++----- .../getting-started-config/java.logback.mdx | 20 ++++-- .../getting-started-config/java.mdx | 24 +++---- .../opentelemetry/java.mdx | 32 +++++++-- .../getting-started-install/java.jul.mdx | 7 -- .../getting-started-install/java.log4j2.mdx | 41 ++---------- .../getting-started-install/java.logback.mdx | 41 ++---------- .../opentelemetry/java.mdx | 3 +- .../getting-started-logs/java.mdx | 16 +++++ .../getting-started-metrics/java.mdx | 20 ++++++ .../getting-started-prerequisites/java.mdx | 7 ++ .../getting-started-primer/java.jul.mdx | 14 +--- .../getting-started-primer/java.log4j2.mdx | 14 +--- .../getting-started-primer/java.logback.mdx | 14 +--- .../getting-started-primer/java.mdx | 2 +- 26 files changed, 345 insertions(+), 208 deletions(-) create mode 100644 docs/platforms/java/guides/jul/index.mdx create mode 100644 docs/platforms/java/guides/log4j2/index.mdx create mode 100644 docs/platforms/java/guides/logback/index.mdx create mode 100644 platform-includes/getting-started-logs/java.mdx create mode 100644 platform-includes/getting-started-metrics/java.mdx create mode 100644 platform-includes/getting-started-prerequisites/java.mdx diff --git a/docs/platforms/java/common/index.mdx b/docs/platforms/java/common/index.mdx index 574759684f532..b0ddd1cec0d57 100644 --- a/docs/platforms/java/common/index.mdx +++ b/docs/platforms/java/common/index.mdx @@ -1,5 +1,7 @@ + + ## Install @@ -8,66 +10,60 @@ Install the Sentry SDK for your Java logging framework or application: - - -If you use the plain SDK setup in Configure, skip the agent download and launch command. - ## Configure -**Error Monitoring** starts when the SDK initializes. This guide configures **Tracing** and **Profiling**. **Logs** require an explicit enable option, which the setup below includes. **Application Metrics** need no extra configuration; send them in [step 4](#send-application-metrics-). +**Error Monitoring** starts once Sentry is configured. **Application Metrics** need no extra configuration, and you'll learn how to send them in step [#4](#send-application-metrics-). This guide also configures **Tracing**, **Logs**, and **Profiling**. -Don't need a feature? Remove its configuration. Remove the `sentry-async-profiler` dependency to disable Profiling. + -The default setup uses the Sentry OpenTelemetry agent. See the [agent setup guide](/platforms/java/opentelemetry/setup/agent/) or [agentless setup guide](/platforms/java/opentelemetry/setup/agentless/) for details. +Don't need a feature? Remove its configuration from the SDK initialization. To disable Profiling, also remove the `sentry-async-profiler` dependency. + +### With OpenTelemetry - +See the [agent setup guide](/platforms/java/opentelemetry/setup/agent/) or [agentless setup guide](/platforms/java/opentelemetry/setup/agentless/) for details. -The following setup initializes the Java SDK without the OpenTelemetry agent. It configures Error Monitoring, Tracing, Profiling, and Logs. Logs are enabled with `logs.enabled=true`; Metrics are available after SDK initialization and have no enable option. +### Without OpenTelemetry - - ## Send Logs -Logs must be enabled in your configuration; the snippets in Configure already do this. Use `Sentry.logger()` to send logs at different levels: - -```java -import io.sentry.Sentry; - -Sentry.logger().info("User example action completed"); -Sentry.logger().warn("Slow operation detected"); -Sentry.logger().error("Validation failed"); -``` - -If you already log with JUL, Log4j2, or Logback, see the [JUL](/platforms/java/guides/jul/), [Log4j2](/platforms/java/guides/log4j2/), and [Logback](/platforms/java/guides/logback/) guides to send those logs to Sentry. Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). + -See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. +We also provide integrations for: +- [Logback](/platforms/java/guides/logback/logs/) +- [Log4j2](/platforms/java/guides/log4j2/logs/) +- [java.util.logging](/platforms/java/guides/jul/logs/) ## Send Application Metrics -Metrics are available after SDK initialization; no additional option is required. Use `Sentry.metrics()` to send counters, gauges, and distributions. Add attributes to filter and group metrics. + -See [Set Up Metrics](/platforms/java/metrics/) for all metric types and configuration options. +## Verify Your Setup -```java -import io.sentry.Sentry; +Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project. -Sentry.metrics().count("checkout.failed", 1.0); -Sentry.metrics().gauge("queue_depth", 42.0); -Sentry.metrics().distribution("response_time", 187.5); -``` +Add this intentional error to your application: -## Verify Your Setup + -Run the following code after initializing the SDK. It captures a test error that you can find in your Sentry project. +### View Captured Data in Sentry - +Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear). + + ## Next Steps - Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup + + + +- Find various topics in Troubleshooting +- [Get support](https://www.sentry.help/en/) + + diff --git a/docs/platforms/java/config.yml b/docs/platforms/java/config.yml index 8cff769ae061e..64a57d2686a90 100644 --- a/docs/platforms/java/config.yml +++ b/docs/platforms/java/config.yml @@ -1,4 +1,5 @@ title: Java +description: "Learn how to set up Sentry in your Java application and capture your first events." caseStyle: camelCase supportLevel: production sdk: sentry.java diff --git a/docs/platforms/java/guides/jul/config.yml b/docs/platforms/java/guides/jul/config.yml index 5267f728b8335..4598d33eb9662 100644 --- a/docs/platforms/java/guides/jul/config.yml +++ b/docs/platforms/java/guides/jul/config.yml @@ -1,4 +1,5 @@ title: java.util.logging +description: "Learn how to set up Sentry's JUL integration to capture logs." caseStyle: camelCase supportLevel: production sdk: sentry.java.jul diff --git a/docs/platforms/java/guides/jul/index.mdx b/docs/platforms/java/guides/jul/index.mdx new file mode 100644 index 0000000000000..b4288a0d5a6e0 --- /dev/null +++ b/docs/platforms/java/guides/jul/index.mdx @@ -0,0 +1,47 @@ + + + + + + +## Install + +Add the `sentry-jul` dependency to your project: + + + +## Configure + + + +## Verify Your Setup + +To verify that the integration is working, log an error through JUL: + +```java +import java.util.logging.Level; +import java.util.logging.Logger; + +Logger logger = Logger.getLogger("example"); +logger.log(Level.SEVERE, "This is a test.", new Exception("This is a test.")); +``` + +### View Captured Data in Sentry + +Now, open the [**Logs**](https://sentry.io/orgredirect/organizations/:orgslug/explore/logs/) page and filter by service, environment, or search keywords to view log entries from your application (it takes a couple of moments for the data to appear). + +## Next Steps + +- Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup +- Learn more about setting up logging +- Learn how to [send application metrics](/platforms/java/metrics/) and [traces](/platforms/java/tracing/) +- Configure [profiling](/platforms/java/profiling/) to capture performance data from your application + + + + + +- Find various topics in Troubleshooting +- [Get support](https://www.sentry.help/en/) + + diff --git a/docs/platforms/java/guides/log4j2/config.yml b/docs/platforms/java/guides/log4j2/config.yml index b253929a83147..18e33d7b4f264 100644 --- a/docs/platforms/java/guides/log4j2/config.yml +++ b/docs/platforms/java/guides/log4j2/config.yml @@ -1,4 +1,5 @@ title: Log4j 2.x +description: "Learn how to set up Sentry's Log4j 2.x integration to capture logs." caseStyle: camelCase supportLevel: production sdk: sentry.java.log4j2 diff --git a/docs/platforms/java/guides/log4j2/index.mdx b/docs/platforms/java/guides/log4j2/index.mdx new file mode 100644 index 0000000000000..4b3cef5e70adb --- /dev/null +++ b/docs/platforms/java/guides/log4j2/index.mdx @@ -0,0 +1,47 @@ + + + + + + +## Install + +Add `sentry-log4j2` to your project (Maven Plugin and Gradle Plugin automatically add integrations for you): + + + +## Configure + + + +## Verify Your Setup + +To verify that the integration is working, log an error through Log4j2: + +```java +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +Logger logger = LogManager.getLogger("example"); +logger.error("This is a test log message"); +``` + +### View Captured Data in Sentry + +Now, open the [**Logs**](https://sentry.io/orgredirect/organizations/:orgslug/explore/logs/) page and filter by service, environment, or search keywords to view log entries from your application (it takes a couple of moments for the data to appear). + +## Next Steps + +- Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup +- Learn more about setting up logging +- Learn how to [send application metrics](/platforms/java/metrics/) and [traces](/platforms/java/tracing/) +- Configure [profiling](/platforms/java/profiling/) to capture performance data from your application + + + + + +- Find various topics in Troubleshooting +- [Get support](https://www.sentry.help/en/) + + diff --git a/docs/platforms/java/guides/logback/config.yml b/docs/platforms/java/guides/logback/config.yml index 63631c03eab5f..75d0949af9f5e 100644 --- a/docs/platforms/java/guides/logback/config.yml +++ b/docs/platforms/java/guides/logback/config.yml @@ -1,4 +1,5 @@ title: Logback +description: "Learn how to set up Sentry's Logback integration to capture logs." caseStyle: camelCase supportLevel: production sdk: sentry.java.logback diff --git a/docs/platforms/java/guides/logback/index.mdx b/docs/platforms/java/guides/logback/index.mdx new file mode 100644 index 0000000000000..55a466e7099b0 --- /dev/null +++ b/docs/platforms/java/guides/logback/index.mdx @@ -0,0 +1,47 @@ + + + + + + +## Install + +Add `sentry-logback` to your project (Maven Plugin and Gradle Plugin automatically add integrations for you): + + + +## Configure + + + +## Verify Your Setup + +To verify that the integration is working, log an error through Logback: + +```java +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +Logger logger = LoggerFactory.getLogger("example"); +logger.error("This is a test.", new Exception("This is a test.")); +``` + +### View Captured Data in Sentry + +Now, open the [**Logs**](https://sentry.io/orgredirect/organizations/:orgslug/explore/logs/) page and filter by service, environment, or search keywords to view log entries from your application (it takes a couple of moments for the data to appear). + +## Next Steps + +- Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup +- Learn more about setting up logging +- Learn how to [send application metrics](/platforms/java/metrics/) and [traces](/platforms/java/tracing/) +- Configure [profiling](/platforms/java/profiling/) to capture performance data from your application + + + + + +- Find various topics in Troubleshooting +- [Get support](https://www.sentry.help/en/) + + diff --git a/includes/quick-start-features-expandable.mdx b/includes/quick-start-features-expandable.mdx index a5f564a5cb467..b3c5fc345021b 100644 --- a/includes/quick-start-features-expandable.mdx +++ b/includes/quick-start-features-expandable.mdx @@ -111,7 +111,7 @@ import { FeatureInfo } from "sentry-docs/components/featureInfo"; - + - + @@ -8,7 +12,27 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se -```xml +```xml {tabTitle:Without DSN} + + + + + + + + + + + + + + + + + + +``` +```xml {tabTitle:With DSN} @@ -28,28 +52,30 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se ``` + + + `SentryAppender` does not support [Log4j's asynchronous loggers](https://logging.apache.org/log4j/2.x/manual/async.html). The Sentry Java SDK itself is already asynchronous and does not perform any blocking operation on the calling thread. -### DSN Configuration + -Note that **you need to configure your DSN** (client key) only if you wish to initialize the SDK through the Log4j 2 integration. If you're planning to use `Sentry.init` to provide configuration, such as by using the `beforeSend` callback, you **should not** provide the DSN in both `Sentry.init` and the appender configuration; just leave it out of the appender configuration in this case. +Sentry Logs must be enabled for the appender to send log messages as Logs. If Sentry is initialized elsewhere, make sure Logs are enabled there. If the appender initializes the SDK, the `sentry.properties` file as shown in the "Additional Options" section below enables them. -```xml - -``` +### Additional Options If the Appender Initializes Sentry -If the DSN is not present in the `log4j2.xml` configuration, Sentry will attempt to read it from the system property `sentry.dsn`, environment variable `SENTRY_DSN` or the `dsn` property in `sentry.properties` file. [See the configuration page](/platforms/java/configuration/) for more details on external configuration. +If the appender initializes the SDK, you can also use Sentry's static API, as shown on the usage page, to record breadcrumbs, set the current user, or capture events manually. + +To set other options, such as data collection, add a `sentry.properties` file. The DSN is already in the appender, so it isn't needed there. See the [configuration page](/platforms/java/configuration/) for where the SDK reads this file from. ```properties {tabTitle:sentry.properties} -traces-sample-rate=1.0 -profile-session-sample-rate=1.0 -profile-lifecycle=TRACE +# Enable logs +logs.enabled=true + # Use Data Collection defaults but don't collect automatic user information. -# https://docs.sentry.io/platforms/java/guides/log4j2/data-management/data-collected/ +# https://docs.sentry.io/platforms/java/guides/jul/data-management/data-collected/ data-collection.user-info=false -# Configure other data categories here. -logs.enabled=true ``` + ### Minimum Log Level Two log levels are used to configure this integration, as illustrated below in the provided code samples: @@ -65,7 +91,16 @@ Setting `minimumEventLevel` or `minimumBreadcrumbLevel` in `log4j2.xml` only aff Breadcrumbs are kept in memory (by default the last 100 records) and are sent with events. For example, by default, if you log 100 entries with `logger.info` or `logger.warn`, no event is sent to Sentry. If you then log with `logger.error`, an event is sent to Sentry that includes those 100 `info` or `warn` messages. For this to work, `SentryAppender` needs to receive **all** log entries to decide what to keep as breadcrumb or send as event. Set the `SentryAppender` log level configuration to a value lower than what is set for the `minimumBreadcrumbLevel` and `minimumEventLevel` so that `SentryAppender` receives these log messages. -```xml +```xml {tabTitle:Without DSN} + + + +``` +```xml {tabTitle:With DSN} ``` -### SDK Configuration -Configure the SDK using a `sentry.properties` file: +Sentry Logs must be enabled for the appender to send log messages as Logs. If Sentry is initialized elsewhere, make sure Logs are enabled there. If the appender initializes the SDK, the `sentry.properties` file as shown in the section below enables them. + +### Set the DSN If Nothing Else Initializes Sentry + +You can skip this section if your application already initializes Sentry through [`Sentry.init`](/platforms/java/), the [Spring](/platforms/java/guides/spring/) or [Spring Boot](/platforms/java/guides/spring-boot/) integration, or the [Sentry OpenTelemetry agent](/platforms/java/opentelemetry/setup/agent/). + +If you haven't initialized Sentry elsewhere, the handler initializes the SDK for you. Configure it with a `sentry.properties` file: ```properties {filename:sentry.properties} dsn=___PUBLIC_DSN___ -traces-sample-rate=1.0 -profile-session-sample-rate=1.0 -profile-lifecycle=TRACE + +# Enable logs +logs.enabled=true + # Use Data Collection defaults but don't collect automatic user information. -# https://docs.sentry.io/platforms/java/guides/logback/data-management/data-collected/ +# https://docs.sentry.io/platforms/java/guides/jul/data-management/data-collected/ data-collection.user-info=false -# Configure other data categories here. ``` You can also provide the DSN through the `sentry.dsn` system property or the `SENTRY_DSN` environment variable. [See the configuration page](/platforms/java/configuration/) for more details on external configuration. + ### Minimum Log Level Two log levels are used to configure this integration: diff --git a/platform-includes/getting-started-config/java.mdx b/platform-includes/getting-started-config/java.mdx index ca58cecb3e439..cb0a86533a14d 100644 --- a/platform-includes/getting-started-config/java.mdx +++ b/platform-includes/getting-started-config/java.mdx @@ -1,4 +1,10 @@ -Configuration should happen as early as possible in your application's lifecycle. +The following setup initializes the Java SDK without the OpenTelemetry agent. Configuration should happen as early as possible in your application's lifecycle. + +The snippet also turns on: +- Tracing: via `tracesSampleRate` +- Profiling: via `profileSessionSampleRate` and `profileLifecycle` +- Data Collection: via `dataCollection` +- Logs: via `logs.enabled` ```java {tabTitle: Java} import io.sentry.ProfileLifecycle; @@ -8,12 +14,11 @@ Sentry.init(options -> { options.setDsn("___PUBLIC_DSN___"); // Use Data Collection defaults but don't collect automatic user information. - // https://docs.sentry.io/platforms/java/data-management/data-collected/ options.getDataCollection().forceDataCollection(); options.getDataCollection().setUserInfo(false); // Configure other data categories here. - // Set traces_sample_rate to 1.0 to capture 100% + // Set setTracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production. options.setTracesSampleRate(1.0); @@ -22,7 +27,7 @@ Sentry.init(options -> { options.setProfileSessionSampleRate(1.0); options.setProfileLifecycle(ProfileLifecycle.TRACE); - // Enable logs to be sent to Sentry + // Enable logs options.getLogs().setEnabled(true); }); ``` @@ -35,12 +40,11 @@ Sentry.init { options -> options.dsn = "___PUBLIC_DSN___" // Use Data Collection defaults but don't collect automatic user information. - // https://docs.sentry.io/platforms/java/data-management/data-collected/ options.dataCollection.forceDataCollection() options.dataCollection.userInfo = false // Configure other data categories here. - // Set traces_sample_rate to 1.0 to capture 100% + // Set tracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0 @@ -49,13 +53,7 @@ Sentry.init { options -> options.profileSessionSampleRate = 1.0 options.profileLifecycle = ProfileLifecycle.TRACE - // Enable logs to be sent to Sentry + // Enable logs options.logs.enabled = true } ``` - - - -Learn more about setting up logging in our [Logs documentation](/platforms/java/logs/). - - diff --git a/platform-includes/getting-started-config/opentelemetry/java.mdx b/platform-includes/getting-started-config/opentelemetry/java.mdx index e4afd0e600611..f24823b4a74cd 100644 --- a/platform-includes/getting-started-config/opentelemetry/java.mdx +++ b/platform-includes/getting-started-config/opentelemetry/java.mdx @@ -1,12 +1,29 @@ -The SDK can be configured using a `sentry.properties` file: +Sentry's OpenTelemetry agent attaches when the JVM starts and is configured through a `sentry.properties` file. + +Download the latest version of the `sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar` from [MavenCentral](https://search.maven.org/artifact/io.sentry/sentry-opentelemetry-agent): + +```bash +curl https://repo1.maven.org/maven2/io/sentry/sentry-opentelemetry-agent/{{@inject packages.version('sentry.java.opentelemetry-agent') }}/sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -o sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar +``` + +The SDK can be configured using a `sentry.properties` file. + +The snippet also turns on: +- Tracing: via `traces-sample-rate` +- Profiling: via `profile-session-sample-rate` and `profile-lifecycle` +- Data Collection: via `data-collection` +- Logs: via `logs.enabled` ```properties {filename:sentry.properties} dsn=___PUBLIC_DSN___ # Use Data Collection defaults but don't collect automatic user information. -# https://docs.sentry.io/platforms/java/data-management/data-collected/ data-collection.user-info=false # Configure other data categories here. + +# Enable tracing traces-sample-rate=1.0 + +# Enable logs logs.enabled=true # Enable profiling @@ -14,8 +31,11 @@ profile-session-sample-rate=1.0 profile-lifecycle=TRACE ``` - - -Learn more about setting up logging in our [Logs documentation](/platforms/java/logs/). +Then run your application with: +```bash {tabTitle: Environment variable} +SENTRY_PROPERTIES_FILE=sentry.properties JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" java -jar your-application.jar +``` - +```bash {tabTitle: Java CLI argument} +SENTRY_PROPERTIES_FILE=sentry.properties java -javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -jar your-application.jar +``` diff --git a/platform-includes/getting-started-install/java.jul.mdx b/platform-includes/getting-started-install/java.jul.mdx index d4075c0830dbf..6844c6e7949e9 100644 --- a/platform-includes/getting-started-install/java.jul.mdx +++ b/platform-includes/getting-started-install/java.jul.mdx @@ -4,21 +4,14 @@ sentry-jul {{@inject packages.version('sentry.java.jul', '4.1.0') }} - - io.sentry - sentry-async-profiler - {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} - ``` ```groovy {tabTitle:Gradle} implementation 'io.sentry:sentry-jul:{{@inject packages.version('sentry.java.jul', '4.1.0') }}' -implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' ``` ```scala {tabTitle: SBT} libraryDependencies += "io.sentry" % "sentry-jul" % "{{@inject packages.version('sentry.java.jul', '4.1.0') }}" -libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" ``` For other dependency managers, see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-jul). diff --git a/platform-includes/getting-started-install/java.log4j2.mdx b/platform-includes/getting-started-install/java.log4j2.mdx index 0671cc9e37596..3ba1995a89d6a 100644 --- a/platform-includes/getting-started-install/java.log4j2.mdx +++ b/platform-includes/getting-started-install/java.log4j2.mdx @@ -3,40 +3,17 @@ io.sentry sentry-maven-plugin {{@inject packages.version('sentry.java.maven-plugin', '0.0.2') }} - + true - - - ___SENTRY_ORG_SLUG___ - ___SENTRY_PROJECT_SLUG___ - - - ___SENTRY_AUTH_TOKEN___ - - true + - - - - - - uploadSourceBundle - - - - validateSdkDependencyVersions - - + - - io.sentry - sentry-async-profiler - {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} - + ``` @@ -46,30 +23,20 @@ sentry-log4j2 {{@inject packages.version('sentry.java.log4j2', '4.2.0') }} - - io.sentry - sentry-async-profiler - {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} - ``` ```groovy {tabTitle:Gradle Plugin} plugins { id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" } -dependencies { - implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -} ``` ```groovy {tabTitle:Gradle} implementation 'io.sentry:sentry-log4j2:{{@inject packages.version('sentry.java.log4j2', '4.2.0') }}' -implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' ``` ```scala {tabTitle: SBT} libraryDependencies += "io.sentry" % "sentry-log4j2" % "{{@inject packages.version('sentry.java.log4j2', '4.2.0') }}" -libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" ``` For other dependency managers see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-log4j2). diff --git a/platform-includes/getting-started-install/java.logback.mdx b/platform-includes/getting-started-install/java.logback.mdx index b7c24fe52049f..35089269018fe 100644 --- a/platform-includes/getting-started-install/java.logback.mdx +++ b/platform-includes/getting-started-install/java.logback.mdx @@ -3,40 +3,17 @@ io.sentry sentry-maven-plugin {{@inject packages.version('sentry.java.maven-plugin', '0.0.2') }} - + true - - - ___SENTRY_ORG_SLUG___ - ___SENTRY_PROJECT_SLUG___ - - - ___SENTRY_AUTH_TOKEN___ - - true + - - - - - - uploadSourceBundle - - - - validateSdkDependencyVersions - - + - - io.sentry - sentry-async-profiler - {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} - + ``` @@ -46,30 +23,20 @@ sentry-logback {{@inject packages.version('sentry.java.logback', '4.2.0') }} - - io.sentry - sentry-async-profiler - {{@inject packages.version('sentry.java.async-profiler', '8.23.0') }} - ``` ```groovy {tabTitle:Gradle Plugin} plugins { id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" } -dependencies { - implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' -} ``` ```groovy {tabTitle:Gradle} implementation 'io.sentry:sentry-logback:{{@inject packages.version('sentry.java.logback', '4.2.0') }}' -implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' ``` ```scala {tabTitle: SBT} libraryDependencies += "io.sentry" % "sentry-logback" % "{{@inject packages.version('sentry.java.logback', '4.2.0') }}" -libraryDependencies += "io.sentry" % "sentry-async-profiler" % "{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}" ``` For other dependency managers, see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-logback). diff --git a/platform-includes/getting-started-install/opentelemetry/java.mdx b/platform-includes/getting-started-install/opentelemetry/java.mdx index 0c4c1e963e4c4..2b60332127b16 100644 --- a/platform-includes/getting-started-install/opentelemetry/java.mdx +++ b/platform-includes/getting-started-install/opentelemetry/java.mdx @@ -1,4 +1,5 @@ -When running your application, please add our `sentry-opentelemetry-agent` to the `java` command. + +When running your application, add our `sentry-opentelemetry-agent` to the `java` command. Download the latest version of the `sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar` from [MavenCentral](https://search.maven.org/artifact/io.sentry/sentry-opentelemetry-agent): ```bash diff --git a/platform-includes/getting-started-logs/java.mdx b/platform-includes/getting-started-logs/java.mdx new file mode 100644 index 0000000000000..36d41f2a986c9 --- /dev/null +++ b/platform-includes/getting-started-logs/java.mdx @@ -0,0 +1,16 @@ +Use `Sentry.logger` to send logs at different levels, such as `info`, `warn`, or `error`. You can pass any attributes you want and search or filter by them later. +See Set Up Logs for all available logging methods and the syntax for formatting messages. + +```javascript +Sentry.logger.info("User example action completed"); + +Sentry.logger.warn("Slow operation detected", { + operation: "data_fetch", + duration: 3500, +}); + +Sentry.logger.error("Validation failed", { + form_field: "email", + reason: "Invalid email", +}); +``` diff --git a/platform-includes/getting-started-metrics/java.mdx b/platform-includes/getting-started-metrics/java.mdx new file mode 100644 index 0000000000000..79d177385c429 --- /dev/null +++ b/platform-includes/getting-started-metrics/java.mdx @@ -0,0 +1,20 @@ +Use `Sentry.metrics()` to send counters, gauges, and distributions from your app to Sentry. You can pass any attributes you want and search or filter by them later. + +See Set Up Metrics for all metric types and configuration options. + +```java +import io.sentry.Sentry; + +Sentry.metrics().count("checkout.failed", 1.0); +Sentry.metrics().gauge("queue_depth", 42.0); + +Sentry.metrics().distribution( + "page_load", + 1.0, + MetricsUnit.Duration.MILLISECOND, + SentryMetricsParameters.create( + Map.of("browser", "Firefox") + ) +); + +``` diff --git a/platform-includes/getting-started-prerequisites/java.mdx b/platform-includes/getting-started-prerequisites/java.mdx new file mode 100644 index 0000000000000..f927936bb461f --- /dev/null +++ b/platform-includes/getting-started-prerequisites/java.mdx @@ -0,0 +1,7 @@ +## Prerequisites + +You need: + +- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/) +- Your application up and running +- Java version `8` (also known as Java `1.8`) or above diff --git a/platform-includes/getting-started-primer/java.jul.mdx b/platform-includes/getting-started-primer/java.jul.mdx index 2f2e401b92d3b..c4f331897064b 100644 --- a/platform-includes/getting-started-primer/java.jul.mdx +++ b/platform-includes/getting-started-primer/java.jul.mdx @@ -1,13 +1 @@ - - -The `sentry-jul` library provides a [java.util.logging Handler](http://docs.oracle.com/javase/8/docs/api/java/util/logging/Handler.html) that sends logged exceptions to Sentry. - - - - - - Enable the Sentry Logs feature to unlock Sentry's full logging power. With Sentry Logs, you can search, filter, and analyze logs from across your entire application in one place. - - - -Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](/platforms/java/usage/), in order to do things like record breadcrumbs, set the current user, or manually send events. The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-jul). +The `sentry-jul` library provides a [java.util.logging Handler](http://docs.oracle.com/javase/8/docs/api/java/util/logging/Handler.html) that sends logged exceptions to Sentry. You can find the source [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-jul). diff --git a/platform-includes/getting-started-primer/java.log4j2.mdx b/platform-includes/getting-started-primer/java.log4j2.mdx index 16eea7f3c98a8..f1cd7b3b36af0 100644 --- a/platform-includes/getting-started-primer/java.log4j2.mdx +++ b/platform-includes/getting-started-primer/java.log4j2.mdx @@ -1,13 +1 @@ - - -The `sentry-log4j2` library provides [Log4j 2.x](https://logging.apache.org/log4j/2.x/) support for Sentry via an [Appender](https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/Appender.html) that sends logged exceptions to Sentry. - - - - - - Enable the Sentry Logs feature to unlock Sentry's full logging power. With Sentry Logs, you can search, filter, and analyze logs from across your entire application in one place. - - - -Once the integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](/platforms/java/usage/), in order to do things like record breadcrumbs, set the current user, or manually send events. The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-log4j2). +The `sentry-log4j2` library provides [Log4j 2.x](https://logging.apache.org/log4j/2.x/) support for Sentry via an [Appender](https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/Appender.html) that sends logged exceptions to Sentry. You can find the source [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-log4j2). diff --git a/platform-includes/getting-started-primer/java.logback.mdx b/platform-includes/getting-started-primer/java.logback.mdx index e078695116382..97ba212b4a5f0 100644 --- a/platform-includes/getting-started-primer/java.logback.mdx +++ b/platform-includes/getting-started-primer/java.logback.mdx @@ -1,13 +1 @@ - - -The `sentry-logback` library provides [Logback](https://logback.qos.ch/) support for Sentry using an [Appender](https://logback.qos.ch/manual/appenders.html) that sends logged exceptions to Sentry. - - - - - - Enable the Sentry Logs feature to unlock Sentry's full logging power. With Sentry Logs, you can search, filter, and analyze logs from across your entire application in one place. - - - -Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](/platforms/java/usage/), in order to do things like record breadcrumbs, set the current user, or manually send events. The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-logback). +The `sentry-logback` library provides [Logback](https://logback.qos.ch/) support for Sentry using an [Appender](https://logback.qos.ch/manual/appenders.html) that sends logged exceptions to Sentry. You can find the source [on GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-logback). diff --git a/platform-includes/getting-started-primer/java.mdx b/platform-includes/getting-started-primer/java.mdx index 71d9f4d17370b..4ef723ccdf824 100644 --- a/platform-includes/getting-started-primer/java.mdx +++ b/platform-includes/getting-started-primer/java.mdx @@ -2,7 +2,7 @@ Sentry's Java SDK enables capturing sessions for Release health as well as reporting messages and errors. -Sentry for Java is a collection of modules provided by Sentry; it supports Java 1.8 and above. At its core, Sentry for Java provides a raw client for sending events to Sentry. To begin, we **highly recommend** you use one of the logging libraries or framework integrations. +Sentry for Java is a collection of modules provided by Sentry. At its core, Sentry for Java provides a raw client for sending events to Sentry. To begin, we **highly recommend** you use one of the logging libraries or framework integrations. From c37b317b5f0e072af25a0ccc84731b3495d97fc7 Mon Sep 17 00:00:00 2001 From: inventarSarah Date: Tue, 10 Nov 2026 09:38:18 +0100 Subject: [PATCH 5/7] update code logs & metrics snippets; update Servlet --- docs/platforms/java/guides/jul/config.yml | 5 -- docs/platforms/java/guides/jul/index.mdx | 7 +++ docs/platforms/java/guides/log4j2/config.yml | 5 -- docs/platforms/java/guides/log4j2/index.mdx | 7 +++ docs/platforms/java/guides/logback/config.yml | 5 -- docs/platforms/java/guides/logback/index.mdx | 7 +++ docs/platforms/java/guides/servlet/config.yml | 1 + includes/quick-start-features-expandable.mdx | 2 +- .../quick-start-locate-data-expandable.mdx | 2 +- .../getting-started-config/java.servlet.mdx | 10 +++- .../getting-started-logs/java.mdx | 56 +++++++++++++++---- .../getting-started-metrics/java.mdx | 36 ++++++++++-- 12 files changed, 108 insertions(+), 35 deletions(-) delete mode 100644 docs/platforms/java/guides/jul/config.yml delete mode 100644 docs/platforms/java/guides/log4j2/config.yml delete mode 100644 docs/platforms/java/guides/logback/config.yml diff --git a/docs/platforms/java/guides/jul/config.yml b/docs/platforms/java/guides/jul/config.yml deleted file mode 100644 index 4598d33eb9662..0000000000000 --- a/docs/platforms/java/guides/jul/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -title: java.util.logging -description: "Learn how to set up Sentry's JUL integration to capture logs." -caseStyle: camelCase -supportLevel: production -sdk: sentry.java.jul diff --git a/docs/platforms/java/guides/jul/index.mdx b/docs/platforms/java/guides/jul/index.mdx index b4288a0d5a6e0..e9ce06e7a6562 100644 --- a/docs/platforms/java/guides/jul/index.mdx +++ b/docs/platforms/java/guides/jul/index.mdx @@ -1,3 +1,10 @@ +--- +title: java.util.logging +description: "Learn how to set up Sentry's JUL integration to capture logs." +caseStyle: camelCase +supportLevel: production +sdk: sentry.java.jul +--- diff --git a/docs/platforms/java/guides/log4j2/config.yml b/docs/platforms/java/guides/log4j2/config.yml deleted file mode 100644 index 18e33d7b4f264..0000000000000 --- a/docs/platforms/java/guides/log4j2/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -title: Log4j 2.x -description: "Learn how to set up Sentry's Log4j 2.x integration to capture logs." -caseStyle: camelCase -supportLevel: production -sdk: sentry.java.log4j2 diff --git a/docs/platforms/java/guides/log4j2/index.mdx b/docs/platforms/java/guides/log4j2/index.mdx index 4b3cef5e70adb..d2dbea3a06db3 100644 --- a/docs/platforms/java/guides/log4j2/index.mdx +++ b/docs/platforms/java/guides/log4j2/index.mdx @@ -1,3 +1,10 @@ +--- +title: Log4j 2.x +description: "Learn how to set up Sentry's Log4j 2.x integration to capture logs." +caseStyle: camelCase +supportLevel: production +sdk: sentry.java.log4j2 +--- diff --git a/docs/platforms/java/guides/logback/config.yml b/docs/platforms/java/guides/logback/config.yml deleted file mode 100644 index 75d0949af9f5e..0000000000000 --- a/docs/platforms/java/guides/logback/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -title: Logback -description: "Learn how to set up Sentry's Logback integration to capture logs." -caseStyle: camelCase -supportLevel: production -sdk: sentry.java.logback diff --git a/docs/platforms/java/guides/logback/index.mdx b/docs/platforms/java/guides/logback/index.mdx index 55a466e7099b0..bfd248f4e01c9 100644 --- a/docs/platforms/java/guides/logback/index.mdx +++ b/docs/platforms/java/guides/logback/index.mdx @@ -1,3 +1,10 @@ +--- +title: Logback +description: "Learn how to set up Sentry's Logback integration to capture logs." +caseStyle: camelCase +supportLevel: production +sdk: sentry.java.logback +--- diff --git a/docs/platforms/java/guides/servlet/config.yml b/docs/platforms/java/guides/servlet/config.yml index 50cb106924cb9..9b87aa1c7d00d 100644 --- a/docs/platforms/java/guides/servlet/config.yml +++ b/docs/platforms/java/guides/servlet/config.yml @@ -1,4 +1,5 @@ title: Servlet +description: Learn how to set up Sentry in your Servlet-based Java application and capture your first events. caseStyle: camelCase supportLevel: production sdk: sentry.java.servlet diff --git a/includes/quick-start-features-expandable.mdx b/includes/quick-start-features-expandable.mdx index b3c5fc345021b..e3243bc8fb5d9 100644 --- a/includes/quick-start-features-expandable.mdx +++ b/includes/quick-start-features-expandable.mdx @@ -111,7 +111,7 @@ import { FeatureInfo } from "sentry-docs/components/featureInfo"; - + - + `tracesSampleRate` +- Profiling: via `profileSessionSampleRate` and `profileLifecycle` +- Data Collection: via `dataCollection` +- Logs: via `logs.enabled` + ```java package sentry.sample; @@ -19,7 +24,6 @@ public final class SentryInitializer implements ServletContainerInitializer { options.setDsn("___PUBLIC_DSN___"); // Use Data Collection defaults but don't collect automatic user information. - // https://docs.sentry.io/platforms/java/guides/servlet/data-management/data-collected/ options.getDataCollection().forceDataCollection(); options.getDataCollection().setUserInfo(false); // Configure other data categories here. @@ -33,7 +37,7 @@ public final class SentryInitializer implements ServletContainerInitializer { options.setProfileSessionSampleRate(1.0); options.setProfileLifecycle(ProfileLifecycle.TRACE); - // Enable logs to be sent to Sentry + // Enable logs options.getLogs().setEnabled(true); }); } diff --git a/platform-includes/getting-started-logs/java.mdx b/platform-includes/getting-started-logs/java.mdx index 36d41f2a986c9..d36b686af552a 100644 --- a/platform-includes/getting-started-logs/java.mdx +++ b/platform-includes/getting-started-logs/java.mdx @@ -1,16 +1,50 @@ -Use `Sentry.logger` to send logs at different levels, such as `info`, `warn`, or `error`. You can pass any attributes you want and search or filter by them later. +Use `Sentry.logger()` to send logs at different levels, such as `info`, `warn`, or `error`. You can pass any attributes you want and search or filter by them later. See Set Up Logs for all available logging methods and the syntax for formatting messages. -```javascript -Sentry.logger.info("User example action completed"); +```java +import io.sentry.Sentry; +import io.sentry.SentryAttribute; +import io.sentry.SentryAttributes; +import io.sentry.SentryLogLevel; +import io.sentry.logger.SentryLogParameters; -Sentry.logger.warn("Slow operation detected", { - operation: "data_fetch", - duration: 3500, -}); -Sentry.logger.error("Validation failed", { - form_field: "email", - reason: "Invalid email", -}); +Sentry.logger().info("A simple log message"); +Sentry.logger().error("A %s log message", "formatted"); + +// attach custom attributes with Sentry.logger().log() +Sentry.logger().log( + SentryLogLevel.FATAL, + SentryLogParameters.create( + SentryAttributes.of( + SentryAttribute.stringAttribute("my.string-attribute", "some-value"), + SentryAttribute.named("my.attribute", new Point(1, 2)) + ) + ), + "log message %s", + "param1" +); +``` +```kotlin +import io.sentry.Sentry +import io.sentry.SentryAttribute +import io.sentry.SentryAttributes +import io.sentry.SentryLogLevel +import io.sentry.logger.SentryLogParameters + +Sentry.logger().info("A simple log message") +Sentry.logger().error("A %s log message", "formatted") + +// attach custom attributes with Sentry.logger().log() +Sentry.logger().log( + SentryLogLevel.FATAL, + SentryLogParameters.create( + SentryAttributes.of( + SentryAttribute.stringAttribute("my.string-attribute", "some-value"), + SentryAttribute.named("my.attribute", Point(1, 2)) + ) + ), + "log message %s", + "param1" +) ``` diff --git a/platform-includes/getting-started-metrics/java.mdx b/platform-includes/getting-started-metrics/java.mdx index 79d177385c429..59ec8bae95bff 100644 --- a/platform-includes/getting-started-metrics/java.mdx +++ b/platform-includes/getting-started-metrics/java.mdx @@ -3,18 +3,46 @@ Use `Sentry.metrics()` to send counters, gauges, and distributions from your app See Set Up Metrics for all metric types and configuration options. ```java -import io.sentry.Sentry; +import io.sentry.Sentry +import io.sentry.SentryAttribute +import io.sentry.SentryAttributes +import io.sentry.metrics.MetricsUnit +import io.sentry.metrics.SentryMetricsParameters -Sentry.metrics().count("checkout.failed", 1.0); +Sentry.metrics().count("button_click", 1.0); Sentry.metrics().gauge("queue_depth", 42.0); +// pass additional attributes via SentryMetricsParameters Sentry.metrics().distribution( - "page_load", + "response_time", 1.0, MetricsUnit.Duration.MILLISECOND, SentryMetricsParameters.create( - Map.of("browser", "Firefox") + SentryAttributes.of( + SentryAttribute.stringAttribute("browser", "Firefox") + ) ) ); +``` +```kotlin +import io.sentry.Sentry +import io.sentry.SentryAttribute +import io.sentry.SentryAttributes +import io.sentry.metrics.MetricsUnit +import io.sentry.metrics.SentryMetricsParameters + +Sentry.metrics().count("button_click", 1.0) +Sentry.metrics().gauge("queue_depth", 42.0) +// pass additional attributes via SentryMetricsParameters +Sentry.metrics().distribution( + "response_time", + 1.0, + MetricsUnit.Duration.MILLISECOND, + SentryMetricsParameters.create( + SentryAttributes.of( + SentryAttribute.stringAttribute("browser", "Firefox") + ) + ) +) ``` From b7e9bd337760d39b539dfe7e1d828119df35e955 Mon Sep 17 00:00:00 2001 From: inventarSarah Date: Tue, 10 Nov 2026 11:41:30 +0100 Subject: [PATCH 6/7] update java spring --- docs/platforms/java/guides/spring/config.yml | 4 - docs/platforms/java/guides/spring/index.mdx | 73 +++++++++---------- includes/quick-start-features-expandable.mdx | 2 +- .../quick-start-locate-data-expandable.mdx | 2 +- .../getting-started-config/java.spring.mdx | 48 ++++++------ .../opentelemetry/java.spring.mdx | 43 +++++------ .../opentelemetry/java.mdx | 16 ---- .../opentelemetry/java.spring.mdx | 25 ------- .../java.spring.mdx | 8 ++ .../getting-started-primer/java.spring.mdx | 16 +--- 10 files changed, 89 insertions(+), 148 deletions(-) delete mode 100644 docs/platforms/java/guides/spring/config.yml delete mode 100644 platform-includes/getting-started-install/opentelemetry/java.mdx delete mode 100644 platform-includes/getting-started-install/opentelemetry/java.spring.mdx create mode 100644 platform-includes/getting-started-prerequisites/java.spring.mdx diff --git a/docs/platforms/java/guides/spring/config.yml b/docs/platforms/java/guides/spring/config.yml deleted file mode 100644 index 55b567d44205f..0000000000000 --- a/docs/platforms/java/guides/spring/config.yml +++ /dev/null @@ -1,4 +0,0 @@ -title: Spring -caseStyle: camelCase -supportLevel: production -sdk: sentry.java.spring diff --git a/docs/platforms/java/guides/spring/index.mdx b/docs/platforms/java/guides/spring/index.mdx index 534e8f67c9227..770b75584389b 100644 --- a/docs/platforms/java/guides/spring/index.mdx +++ b/docs/platforms/java/guides/spring/index.mdx @@ -1,79 +1,76 @@ --- title: "Spring" description: "Learn how to set up Sentry in your Spring application and capture your first events." +caseStyle: camelCase +supportLevel: production sdk: sentry.java.spring --- + + ## Install + +There are multiple variants of Sentry available for Spring: +- For Spring 5, use `sentry-spring` ([GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-spring)) +- For Spring 6, use `sentry-spring-jakarta` ([GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-spring-jakarta)) +- For Spring 7, use `sentry-spring-7` ([GitHub](https://github.com/getsentry/sentry-java/tree/main/sentry-spring-7)) + + Install the Sentry Spring integration: - - -If you use the plain SDK setup in Configure, skip the agent download and launch command. - ## Configure -**Error Monitoring** starts when the Spring integration initializes. This guide configures **Tracing** and **Profiling**. **Logs** require an explicit enable option, which the setup below includes. **Application Metrics** need no extra configuration; send them in [step 4](#send-application-metrics-). - -Don't need a feature? Remove its configuration. Remove the `sentry-async-profiler` dependency to disable Profiling. - -The default setup uses the Sentry OpenTelemetry agent. See the [agent setup guide](/platforms/java/opentelemetry/setup/agent/) or [agentless setup guide](/platforms/java/opentelemetry/setup/agentless/) for details. +**Error Monitoring** starts once Sentry is configured. **Application Metrics** need no extra configuration, and you'll learn how to send them in step [#4](#send-application-metrics-). This guide also configures **Tracing**, **Logs**, and **Profiling**. - - - - -The following setup initializes Sentry through the Spring integration without the OpenTelemetry agent. It configures Error Monitoring, Tracing, Profiling, and Logs. Logs are enabled with `logs.enabled=true`; Metrics are available after SDK initialization and have no enable option. + - + ## Send Logs -Logs must be enabled in your configuration; the snippets in Configure already do this. Use `Sentry.logger()` to send logs at different levels: - -```java -import io.sentry.Sentry; + -Sentry.logger().info("User example action completed"); -Sentry.logger().warn("Slow operation detected"); -Sentry.logger().error("Validation failed"); -``` - -If you already log with JUL, Log4j2, or Logback, see the [JUL](/platforms/java/guides/jul/), [Log4j2](/platforms/java/guides/log4j2/), and [Logback](/platforms/java/guides/logback/) guides to send those logs to Sentry. Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). - -See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. +We also provide integrations for: +- [Logback](/platforms/java/guides/logback/logs/) +- [Log4j2](/platforms/java/guides/log4j2/logs/) +- [java.util.logging](/platforms/java/guides/jul/logs/) ## Send Application Metrics -Metrics are available after SDK initialization; no additional option is required. Use `Sentry.metrics()` to send counters, gauges, and distributions. Add attributes to filter and group metrics. + -See [Set Up Metrics](/platforms/java/metrics/) for all metric types and configuration options. +## Verify Your Setup -```java -import io.sentry.Sentry; +Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project. -Sentry.metrics().count("checkout.failed", 1.0); -Sentry.metrics().gauge("queue_depth", 42.0); -Sentry.metrics().distribution("response_time", 187.5); -``` +Add this intentional error to your application: -## Verify Your Setup + -Run the following code after initializing the SDK. It captures a test error that you can find in your Sentry project. +### View Captured Data in Sentry - +Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear). + + ## Next Steps - Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup + + + +- Find various topics in Troubleshooting +- [Get support](https://www.sentry.help/en/) + + diff --git a/includes/quick-start-features-expandable.mdx b/includes/quick-start-features-expandable.mdx index e3243bc8fb5d9..c576508814351 100644 --- a/includes/quick-start-features-expandable.mdx +++ b/includes/quick-start-features-expandable.mdx @@ -111,7 +111,7 @@ import { FeatureInfo } from "sentry-docs/components/featureInfo"; - + - + `data-collection` +- Tracing: via `traces-sample-rate` +- Profiling: via `profile-session-sample-rate` and `profile-lifecycle` +- Logs: via `logs.enabled` + +Don't need a feature? Remove its configuration. Remove the `sentry-async-profiler` dependency to disable Profiling. ```properties {filename:sentry.properties} # Use Data Collection defaults but don't collect automatic user information. data-collection.user-info=false # Configure other data categories here. + +# Enable tracing +traces-sample-rate=1.0 + +# Enable profiling +profile-session-sample-rate=1.0 +profile-lifecycle=TRACE + +# Enable logs +logs.enabled=true ``` -The DSN can be also provided through the system property `sentry.dsn`, environment variable `SENTRY_DSN` or the `dsn` property in `sentry.properties` file. [See the configuration page](/platforms/java/configuration/) for more details on external configuration. +The DSN can also come from the `sentry.dsn` system property, the `SENTRY_DSN` environment variable, or `sentry.properties`. See the [configuration page](/platforms/java/configuration/) for details on external configuration. -Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](/platforms/java/usage/), to record breadcrumbs, set the current user, or manually send events, for example. +### Capture Handled Exceptions -By default, only unhandled exceptions are sent to Sentry. This behavior can be tuned through configuring the `exceptionResolverOrder` property. For example, setting it to `Ordered#HIGHEST_PRECEDENCE` ensures exceptions that have been handled by exception resolvers with higher order are sent to Sentry - including ones handled by `@ExceptionHandler` annotated methods. +By default, only unhandled exceptions are sent to Sentry. You can tune this behavior through configuring the `exceptionResolverOrder` property. For example, setting it to `Ordered#HIGHEST_PRECEDENCE` ensures exceptions that have been handled by exception resolvers with higher order are sent to Sentry – including ones handled by `@ExceptionHandler` annotated methods. ```java {tabTitle:Java (Spring 5)} {mdExpandTabs} @@ -161,16 +174,3 @@ import org.springframework.core.Ordered ) class SentryConfiguration ``` - - -The SDK can be configured using a `sentry.properties` file: - -```properties {filename:sentry.properties} -# Enable tracing -traces-sample-rate=1.0 -# Enable profiling -profile-session-sample-rate=1.0 -profile-lifecycle=TRACE -# Enable logs -logs.enabled=true -``` diff --git a/platform-includes/getting-started-config/opentelemetry/java.spring.mdx b/platform-includes/getting-started-config/opentelemetry/java.spring.mdx index ec259dbfa542e..7e713eac40e56 100644 --- a/platform-includes/getting-started-config/opentelemetry/java.spring.mdx +++ b/platform-includes/getting-started-config/opentelemetry/java.spring.mdx @@ -1,34 +1,29 @@ -The Spring integration initializes the SDK and the OpenTelemetry agent provides automatic instrumentation. Add `@EnableSentry` to a Spring configuration class and set the DSN: +### Add the OpenTelemetry Agent (Optional) -```java {tabTitle: Spring 5} -import io.sentry.spring.EnableSentry; +Sentry's OpenTelemetry support lets Sentry use OpenTelemetry instrumentation to trace your application. +Sentry's agent attaches when the JVM starts. Your configuration stays the same, but Sentry is still initialized by `@EnableSentry`, so set `SENTRY_AUTO_INIT=false` to stop the agent from initializing it as well. -@EnableSentry(dsn = "___PUBLIC_DSN___") -@Configuration -class SentryConfiguration {} +Download the latest version of the `sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar` from [MavenCentral](https://search.maven.org/artifact/io.sentry/sentry-opentelemetry-agent): +```bash +curl https://repo1.maven.org/maven2/io/sentry/sentry-opentelemetry-agent/{{@inject packages.version('sentry.java.opentelemetry-agent') }}/sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -o sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar ``` -```java {tabTitle: Spring 6} -import io.sentry.spring.jakarta.EnableSentry; - -@EnableSentry(dsn = "___PUBLIC_DSN___") -@Configuration -class SentryConfiguration {} +Then run your application with: +```bash {tabTitle: Environment variable} +SENTRY_AUTO_INIT=false JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" java -jar your-application.jar ``` -```java {tabTitle: Spring 7} -import io.sentry.spring7.EnableSentry; - -@EnableSentry(dsn = "___PUBLIC_DSN___") -@Configuration -class SentryConfiguration {} +```bash {tabTitle: Java CLI argument} +SENTRY_AUTO_INIT=false java -javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -jar your-application.jar ``` -Configure Tracing, Profiling, and Logs in `sentry.properties`: +If you run a `.WAR` file on an application server, add the agent to the server's `JAVA_OPTS` instead: +```bash {tabTitle: Environment variable} +JAVA_OPTS="${JAVA_OPTS} JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" +``` -```properties {filename:sentry.properties} -traces-sample-rate=1.0 -profile-session-sample-rate=1.0 -profile-lifecycle=TRACE -logs.enabled=true +```bash {tabTitle: Java CLI argument} +JAVA_OPTS="${JAVA_OPTS} JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" ``` + +See the agent setup guide or agentless setup guide for details. diff --git a/platform-includes/getting-started-install/opentelemetry/java.mdx b/platform-includes/getting-started-install/opentelemetry/java.mdx deleted file mode 100644 index 2b60332127b16..0000000000000 --- a/platform-includes/getting-started-install/opentelemetry/java.mdx +++ /dev/null @@ -1,16 +0,0 @@ - -When running your application, add our `sentry-opentelemetry-agent` to the `java` command. - -Download the latest version of the `sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar` from [MavenCentral](https://search.maven.org/artifact/io.sentry/sentry-opentelemetry-agent): -```bash -curl https://repo1.maven.org/maven2/io/sentry/sentry-opentelemetry-agent/{{@inject packages.version('sentry.java.opentelemetry-agent') }}/sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -o sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -``` - -Then run your application with: -```bash {tabTitle: Environment variable} -SENTRY_PROPERTIES_FILE=sentry.properties JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" java -jar your-application.jar -``` - -```bash {tabTitle: Java CLI argument} -SENTRY_PROPERTIES_FILE=sentry.properties java -javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -jar your-application.jar -``` diff --git a/platform-includes/getting-started-install/opentelemetry/java.spring.mdx b/platform-includes/getting-started-install/opentelemetry/java.spring.mdx deleted file mode 100644 index 05a12ce3741c1..0000000000000 --- a/platform-includes/getting-started-install/opentelemetry/java.spring.mdx +++ /dev/null @@ -1,25 +0,0 @@ -When running your application, please add our `sentry-opentelemetry-agent` to the `java` command. -In case you are using an application server to run your `.WAR` file, please add it to the `JAVA_OPTS` of your application server. - -Download the latest version of the `sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar` from [MavenCentral](https://search.maven.org/artifact/io.sentry/sentry-opentelemetry-agent): -```bash -curl https://repo1.maven.org/maven2/io/sentry/sentry-opentelemetry-agent/{{@inject packages.version('sentry.java.opentelemetry-agent') }}/sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -o sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -``` - -Then run your application with: -```bash {tabTitle: Environment variable} -SENTRY_AUTO_INIT=false JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" java -jar your-application.jar -``` - -```bash {tabTitle: Java CLI argument} -SENTRY_AUTO_INIT=false java -javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -jar your-application.jar -``` - -In case of an application server, adding the Agent might look more like the following: -```bash {tabTitle: Environment variable} -JAVA_OPTS="${JAVA_OPTS} JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" -``` - -```bash {tabTitle: Java CLI argument} -JAVA_OPTS="${JAVA_OPTS} JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" -``` diff --git a/platform-includes/getting-started-prerequisites/java.spring.mdx b/platform-includes/getting-started-prerequisites/java.spring.mdx new file mode 100644 index 0000000000000..11546e979fc50 --- /dev/null +++ b/platform-includes/getting-started-prerequisites/java.spring.mdx @@ -0,0 +1,8 @@ +## Prerequisites + +You need: + +- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/) +- Your application up and running +- Spring Framework `5.1.2`+ + - [Sentry WebFlux integration](/platforms/java/guides/spring-boot/webflux/) requires Spring Framework `5.2.4` or above diff --git a/platform-includes/getting-started-primer/java.spring.mdx b/platform-includes/getting-started-primer/java.spring.mdx index b52f944837d1e..4f193e8e46d2d 100644 --- a/platform-includes/getting-started-primer/java.spring.mdx +++ b/platform-includes/getting-started-primer/java.spring.mdx @@ -1,17 +1,3 @@ - -There are multiple variants of Sentry available for Spring: -- For Spring 5, use `sentry-spring` ([GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-spring)) -- For Spring 6, use `sentry-spring-jakarta` ([GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-spring-jakarta)) -- For Spring 7, use `sentry-spring-7` ([GitHub](https://github.com/getsentry/sentry-java/tree/main/sentry-spring-7)) - -Sentry's integration with [Spring](https://spring.io/projects/spring-framework) supports Spring Framework 5.1.2 and above to report unhandled exceptions and optional user information. If you're on an older version, use [our legacy integration](/platforms/java/legacy/spring/). -The minimum version of Spring Framework supported by the Sentry WebFlux integration is, instead, 5.2.4. - -- Provides a [HandlerExceptionResolver](https://docs.spring.io/spring/docs/4.3.9.RELEASE/javadoc-api/org/springframework/web/servlet/HandlerExceptionResolver.html) to send unhandled exceptions to Sentry -- Attaches HTTP request information to every `SentryEvent` recorded within the scope of the request -- Provides the ability to [record user information](/platforms/java/guides/spring/advanced-usage/) - -To use Sentry with Spring Boot, we recommend using Sentry [Spring Boot integration](/platforms/java/guides/spring-boot/) as it provides richer configuration capabilities. - +Are you using Spring Boot? Then follow our [Spring Boot quick start guide](/platforms/java/guides/spring-boot/) instead. From a9fcc22ffd68c54be71a40ab840b611392815af1 Mon Sep 17 00:00:00 2001 From: inventarSarah Date: Tue, 10 Nov 2026 12:30:37 +0100 Subject: [PATCH 7/7] update spring boot --- .../java/guides/spring-boot/config.yml | 4 -- .../java/guides/spring-boot/index.mdx | 68 ++++++++----------- docs/platforms/java/guides/spring/index.mdx | 9 +-- includes/quick-start-features-expandable.mdx | 2 +- .../quick-start-locate-data-expandable.mdx | 2 +- .../java.spring-boot.mdx | 22 +++--- .../getting-started-config/java.spring.mdx | 2 +- .../opentelemetry/java.spring-boot.mdx | 32 +++++---- .../opentelemetry/java.spring-boot.mdx | 16 ----- .../java.spring-boot.mdx | 10 +++ .../java.spring.mdx | 2 + .../java.spring-boot.mdx | 13 +--- 12 files changed, 78 insertions(+), 104 deletions(-) delete mode 100644 docs/platforms/java/guides/spring-boot/config.yml delete mode 100644 platform-includes/getting-started-install/opentelemetry/java.spring-boot.mdx create mode 100644 platform-includes/getting-started-prerequisites/java.spring-boot.mdx diff --git a/docs/platforms/java/guides/spring-boot/config.yml b/docs/platforms/java/guides/spring-boot/config.yml deleted file mode 100644 index eb2ea100e14ab..0000000000000 --- a/docs/platforms/java/guides/spring-boot/config.yml +++ /dev/null @@ -1,4 +0,0 @@ -title: Spring Boot -caseStyle: camelCase -supportLevel: production -sdk: sentry.java.spring-boot diff --git a/docs/platforms/java/guides/spring-boot/index.mdx b/docs/platforms/java/guides/spring-boot/index.mdx index c80f6f6d0c8bf..154c9af1ade59 100644 --- a/docs/platforms/java/guides/spring-boot/index.mdx +++ b/docs/platforms/java/guides/spring-boot/index.mdx @@ -2,78 +2,68 @@ title: "Spring Boot" description: "Learn how to set up Sentry in your Spring Boot application and capture your first events." sdk: sentry.java.spring-boot +caseStyle: camelCase +supportLevel: production --- + + ## Install -Install the Sentry Spring Boot integration: +Install Sentry for your Spring Boot version: - - -If you use the plain SDK setup in Configure, skip the agent download and launch command. - ## Configure -**Error Monitoring** starts when the Spring Boot integration initializes. This guide configures **Tracing** and **Profiling**. **Logs** require an explicit enable option, which the setup below includes. **Application Metrics** need no extra configuration; send them in [step 4](#send-application-metrics-). +**Error Monitoring** starts once Sentry is configured. **Application Metrics** need no extra configuration, and you'll learn how to send them in step [#4](#send-application-metrics-). This guide also configures **Tracing**, **Logs**, and **Profiling**. -Don't need a feature? Remove its configuration. Remove the `sentry-async-profiler` dependency to disable Profiling. - -The default setup uses the Sentry OpenTelemetry agent. See the [agent setup guide](/platforms/java/opentelemetry/setup/agent/) or [agentless setup guide](/platforms/java/opentelemetry/setup/agentless/) for details. - - - - - -The following setup initializes Sentry through the Spring Boot integration without the OpenTelemetry agent. It configures Error Monitoring, Tracing, Profiling, and Logs. Logs are enabled with `sentry.logs.enabled=true`; Metrics are available after SDK initialization and have no enable option. + - + ## Send Logs -Logs must be enabled in your configuration; the snippets in Configure already do this. Use `Sentry.logger()` to send logs at different levels: - -```java -import io.sentry.Sentry; + -Sentry.logger().info("User example action completed"); -Sentry.logger().warn("Slow operation detected"); -Sentry.logger().error("Validation failed"); -``` - -If you already log with JUL, Log4j2, or Logback, see the [JUL](/platforms/java/guides/jul/), [Log4j2](/platforms/java/guides/log4j2/), and [Logback](/platforms/java/guides/logback/) guides to send those logs to Sentry. Spring Boot users can also use the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/). - -See [Set Up Logs](/platforms/java/logs/) for all logging methods and configuration options. +We also provide integrations for: +- [Logback](/platforms/java/guides/logback/logs/) +- [Log4j2](/platforms/java/guides/log4j2/logs/) +- [java.util.logging](/platforms/java/guides/jul/logs/) ## Send Application Metrics -Metrics are available after SDK initialization; no additional option is required. Use `Sentry.metrics()` to send counters, gauges, and distributions. Add attributes to filter and group metrics. + -See [Set Up Metrics](/platforms/java/metrics/) for all metric types and configuration options. +## Verify Your Setup -```java -import io.sentry.Sentry; +Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project. -Sentry.metrics().count("checkout.failed", 1.0); -Sentry.metrics().gauge("queue_depth", 42.0); -Sentry.metrics().distribution("response_time", 187.5); -``` +Add this intentional error to your application: -## Verify Your Setup + -Run the following code after initializing the SDK. It captures a test error that you can find in your Sentry project. +### View Captured Data in Sentry - +Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear). + + ## Next Steps - Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup + + + +- Find various topics in Troubleshooting +- [Get support](https://www.sentry.help/en/) + + diff --git a/docs/platforms/java/guides/spring/index.mdx b/docs/platforms/java/guides/spring/index.mdx index 770b75584389b..7774b10dea12b 100644 --- a/docs/platforms/java/guides/spring/index.mdx +++ b/docs/platforms/java/guides/spring/index.mdx @@ -14,14 +14,7 @@ sdk: sentry.java.spring ## Install - -There are multiple variants of Sentry available for Spring: -- For Spring 5, use `sentry-spring` ([GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-spring)) -- For Spring 6, use `sentry-spring-jakarta` ([GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-spring-jakarta)) -- For Spring 7, use `sentry-spring-7` ([GitHub](https://github.com/getsentry/sentry-java/tree/main/sentry-spring-7)) - - -Install the Sentry Spring integration: +Install Sentry for your Spring Boot version: diff --git a/includes/quick-start-features-expandable.mdx b/includes/quick-start-features-expandable.mdx index c576508814351..f53f560752261 100644 --- a/includes/quick-start-features-expandable.mdx +++ b/includes/quick-start-features-expandable.mdx @@ -111,7 +111,7 @@ import { FeatureInfo } from "sentry-docs/components/featureInfo"; - + - + `data-collection` +- Tracing: via `tracesSampleRate` +- Profiling: via `profileSessionSampleRate` and `profileLifecycle` +- Logs: via `logs.enabled` +Don't need a feature? Remove its configuration. Remove the `sentry-async-profiler` dependency to disable Profiling. ```properties {filename:application.properties} sentry.dsn=___PUBLIC_DSN___ # Use Data Collection defaults but don't collect automatic user information. -# https://docs.sentry.io/platforms/java/guides/spring-boot/data-management/data-collected/ sentry.data-collection.user-info=false # Configure other data categories here. @@ -29,7 +38,6 @@ sentry: dsn: ___PUBLIC_DSN___ # Use Data Collection defaults but don't collect automatic user information. - # https://docs.sentry.io/platforms/java/guides/spring-boot/data-management/data-collected/ data-collection: user-info: false # Configure other data categories here. @@ -48,7 +56,9 @@ sentry: enabled: true ``` -By default, only unhandled exceptions are sent to Sentry. This behavior can be tuned through configuring the `sentry.exception-resolver-order` property. For example, setting it to `-2147483647` (the value of `org.springframework.core.Ordered#HIGHEST_PRECEDENCE`) ensures exceptions that have been handled by exception resolvers with higher order are sent to Sentry - including ones handled by `@ExceptionHandler` annotated methods. +### Capture Handled Exceptions + +By default, only unhandled exceptions are sent to Sentry. You can tune this behavior by configuring the `sentry.exception-resolver-order` property. For example, setting it to `-2147483647` (the value of `org.springframework.core.Ordered#HIGHEST_PRECEDENCE`) ensures exceptions that have been handled by exception resolvers with higher order are sent to Sentry – including ones handled by `@ExceptionHandler` annotated methods. ```properties {filename:application.properties} sentry.exception-resolver-order=-2147483647 @@ -58,7 +68,3 @@ sentry.exception-resolver-order=-2147483647 sentry: exception-resolver-order: -2147483647 ``` - -We recommend using Sentry's Spring Boot integration with one of the [logging framework integrations](/platforms/java/guides/spring-boot/logging-frameworks/) as they work together seamlessly. To use Sentry **without** Spring Boot, we recommend using the [Sentry Spring integration](/platforms/java/guides/spring/). - -Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](/platforms/java/usage/), to record breadcrumbs, set the current user, or manually send events, for example. diff --git a/platform-includes/getting-started-config/java.spring.mdx b/platform-includes/getting-started-config/java.spring.mdx index 18fa5cac446e5..483a4c6cbb77b 100644 --- a/platform-includes/getting-started-config/java.spring.mdx +++ b/platform-includes/getting-started-config/java.spring.mdx @@ -97,7 +97,7 @@ The DSN can also come from the `sentry.dsn` system property, the `SENTRY_DSN` en ### Capture Handled Exceptions -By default, only unhandled exceptions are sent to Sentry. You can tune this behavior through configuring the `exceptionResolverOrder` property. For example, setting it to `Ordered#HIGHEST_PRECEDENCE` ensures exceptions that have been handled by exception resolvers with higher order are sent to Sentry – including ones handled by `@ExceptionHandler` annotated methods. +By default, only unhandled exceptions are sent to Sentry. You can tune this behavior by configuring the `exceptionResolverOrder` property. For example, setting it to `Ordered#HIGHEST_PRECEDENCE` ensures exceptions that have been handled by exception resolvers with higher order are sent to Sentry – including ones handled by `@ExceptionHandler` annotated methods. ```java {tabTitle:Java (Spring 5)} {mdExpandTabs} diff --git a/platform-includes/getting-started-config/opentelemetry/java.spring-boot.mdx b/platform-includes/getting-started-config/opentelemetry/java.spring-boot.mdx index 4f2982a9acb8b..61fb5ad9b2a8f 100644 --- a/platform-includes/getting-started-config/opentelemetry/java.spring-boot.mdx +++ b/platform-includes/getting-started-config/opentelemetry/java.spring-boot.mdx @@ -1,19 +1,21 @@ -The Spring Boot integration initializes the SDK when the OpenTelemetry agent is installed. Set the DSN and feature options in `application.properties` or `application.yml`: +### Add the OpenTelemetry Agent (Optional) -```properties {filename:application.properties} -sentry.dsn=___PUBLIC_DSN___ -sentry.traces-sample-rate=1.0 -sentry.profile-session-sample-rate=1.0 -sentry.profile-lifecycle=TRACE -sentry.logs.enabled=true +Sentry's OpenTelemetry support lets Sentry use OpenTelemetry instrumentation to trace your application. +Sentry's agent attaches when the JVM starts and you don't need to update your Sentry configuration. + +Download the latest version of the `sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar` from [MavenCentral](https://search.maven.org/artifact/io.sentry/sentry-opentelemetry-agent): +```bash +curl https://repo1.maven.org/maven2/io/sentry/sentry-opentelemetry-agent/{{@inject packages.version('sentry.java.opentelemetry-agent') }}/sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -o sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar ``` -```yaml {filename:application.yml} -sentry: - dsn: ___PUBLIC_DSN___ - traces-sample-rate: 1.0 - profile-session-sample-rate: 1.0 - profile-lifecycle: TRACE - logs: - enabled: true +Then run your application with: + +```bash {tabTitle: Environment variable} +SENTRY_AUTO_INIT=false JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" java -jar your-application.jar ``` + +```bash {tabTitle: Java CLI argument} +SENTRY_AUTO_INIT=false java -javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -jar your-application.jar +``` + +See the agent setup guide or agentless setup guide for details. diff --git a/platform-includes/getting-started-install/opentelemetry/java.spring-boot.mdx b/platform-includes/getting-started-install/opentelemetry/java.spring-boot.mdx deleted file mode 100644 index a3fc2d88c4a89..0000000000000 --- a/platform-includes/getting-started-install/opentelemetry/java.spring-boot.mdx +++ /dev/null @@ -1,16 +0,0 @@ -When running your application, please add our `sentry-opentelemetry-agent` to the `java` command. - -Download the latest version of the `sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar` from [MavenCentral](https://search.maven.org/artifact/io.sentry/sentry-opentelemetry-agent): -```bash -curl https://repo1.maven.org/maven2/io/sentry/sentry-opentelemetry-agent/{{@inject packages.version('sentry.java.opentelemetry-agent') }}/sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -o sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -``` - -Then run your application with: - -```bash {tabTitle: Environment variable} -SENTRY_AUTO_INIT=false JAVA_TOOL_OPTIONS="-javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar" java -jar your-application.jar -``` - -```bash {tabTitle: Java CLI argument} -SENTRY_AUTO_INIT=false java -javaagent:sentry-opentelemetry-agent-{{@inject packages.version('sentry.java.opentelemetry-agent') }}.jar -jar your-application.jar -``` diff --git a/platform-includes/getting-started-prerequisites/java.spring-boot.mdx b/platform-includes/getting-started-prerequisites/java.spring-boot.mdx new file mode 100644 index 0000000000000..95a16945dbeda --- /dev/null +++ b/platform-includes/getting-started-prerequisites/java.spring-boot.mdx @@ -0,0 +1,10 @@ +## Prerequisites + +You need: + +- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/) +- Your application up and running +- Spring Boot `2.1.0`+ + - [Sentry WebFlux integration](/platforms/java/guides/spring-boot/webflux/) requires Spring Boot `2.2.5.RELEASE` or above + +If you're on an older version, use [our legacy integration](/platforms/java/legacy/spring/). diff --git a/platform-includes/getting-started-prerequisites/java.spring.mdx b/platform-includes/getting-started-prerequisites/java.spring.mdx index 11546e979fc50..7b6197b837596 100644 --- a/platform-includes/getting-started-prerequisites/java.spring.mdx +++ b/platform-includes/getting-started-prerequisites/java.spring.mdx @@ -6,3 +6,5 @@ You need: - Your application up and running - Spring Framework `5.1.2`+ - [Sentry WebFlux integration](/platforms/java/guides/spring-boot/webflux/) requires Spring Framework `5.2.4` or above + +If you're on an older version, use [our legacy integration](/platforms/java/legacy/spring/). diff --git a/platform-includes/getting-started-primer/java.spring-boot.mdx b/platform-includes/getting-started-primer/java.spring-boot.mdx index 873056beab061..0bfe586b0f2c7 100644 --- a/platform-includes/getting-started-primer/java.spring-boot.mdx +++ b/platform-includes/getting-started-primer/java.spring-boot.mdx @@ -1,17 +1,8 @@ - - -There are multiple variants of Sentry available for Spring Boot. If you're using our Gradle plugin it will pick the right dependency for you. If you're manually adding the dependency: -- For Spring Boot 2, use `sentry-spring-boot-starter` ([GitHub](https://github.com/getsentry/sentry-java/tree/main/sentry-spring-boot-starter)) -- For Spring Boot 3, use `sentry-spring-boot-starter-jakarta` ([GitHub](https://github.com/getsentry/sentry-java/tree/main/sentry-spring-boot-starter-jakarta)) -- For Spring Boot 4, use `sentry-spring-boot-4` ([GitHub](https://github.com/getsentry/sentry-java/tree/main/sentry-spring-boot-4)) - -Sentry's integration with [Spring Boot](https://spring.io/projects/spring-boot) supports Spring Boot 2.1.0 and above to report unhandled exceptions as well as release and registration of beans. If you're on an older version, use [our legacy integration](/platforms/java/legacy/spring/). -The minimum version of Spring Boot supported by the Sentry WebFlux integration is, instead, 2.2.5.RELEASE. - + The `sentry-spring-boot-starter`, `sentry-spring-boot-starter-jakarta`, and `sentry-spring-boot-4` libraries enhance [Sentry Spring](/platforms/java/guides/spring/) to: - manage a fine-grained configuration using `application.properties` or `application.yaml` - automatically include the release when [Spring Boot Git integration is configured](https://docs.spring.io/spring-boot/how-to/build.html#howto.build.generate-git-info) - automatically register `BeforeSendCallback`, `BeforeBreadcrumbCallback`, `EventProcessor`, `Integration` beans - +