diff --git a/docs/get-started/guides/logs.mdx b/docs/get-started/guides/logs.mdx index 4040c6ee310494..23e8d614fb5bbe 100644 --- a/docs/get-started/guides/logs.mdx +++ b/docs/get-started/guides/logs.mdx @@ -883,7 +883,6 @@ SentryAndroid.init(context) { options -> options.dsn = "..." options.environment = "development" options.tracesSampleRate = 1.0 // 100% of traces - options.logs.enabled = true } ``` diff --git a/docs/platforms/android/index.mdx b/docs/platforms/android/index.mdx index 54974cfc7d4b8d..7a868d320c8bd9 100644 --- a/docs/platforms/android/index.mdx +++ b/docs/platforms/android/index.mdx @@ -130,10 +130,6 @@ Configuration is done via the application `AndroidManifest.xml`. Here's an examp - - - - @@ -142,6 +138,14 @@ Configuration is done via the application `AndroidManifest.xml`. Here's an examp ``` + + + +Calls to `Sentry.logger()` send logs without additional configuration. To capture Timber or Logcat output automatically, enable log capture for the applicable logging integration. + + + + ## Verify Verify that your app is sending events to Sentry by adding the following snippet, which includes an intentional error. You should see the error reported in Sentry within a few minutes. diff --git a/docs/platforms/android/integrations/logcat/index.mdx b/docs/platforms/android/integrations/logcat/index.mdx index 983f5ba8983939..5f4383c63d8b88 100644 --- a/docs/platforms/android/integrations/logcat/index.mdx +++ b/docs/platforms/android/integrations/logcat/index.mdx @@ -10,7 +10,7 @@ og_image: /og-images/platforms-android-integrations-logcat.png -This integration captures Logcat logs as breadcrumbs (great for error context!). But if you need to search and query your logs across your entire application, use Sentry Logs instead. Logcat logs at or above the `minLevel` are automatically sent as Sentry Logs when enabled. See the Support With Sentry Logs section below. +This integration captures Logcat logs as breadcrumbs (great for error context!). But if you need to search and query your logs across your entire application, use Sentry Logs instead. Logcat logs at or above the `minLevel` are sent as Sentry Logs when Logcat log capture is enabled. See the Support With Sentry Logs section below. @@ -135,4 +135,30 @@ Sentry Logs for Logcat are supported in Sentry Android SDK version `8.17.0` and -Logcat logs at or above the `minLevel` captured by Sentry are automatically sent as Sentry Logs, if enabled. +Automatic Sentry Logs capture from Logcat is disabled by default. Enable it in `AndroidManifest.xml`: + +```xml {filename:AndroidManifest.xml} + + + +``` + +Or enable it when initializing the SDK: + +```java {tabTitle:Java} +import io.sentry.android.core.SentryAndroid; + +SentryAndroid.init(this, options -> { + options.setLogcatLogCaptureEnabled(true); +}); +``` + +```kotlin {tabTitle:Kotlin} +import io.sentry.android.core.SentryAndroid + +SentryAndroid.init(this) { options -> + options.logcatLogCaptureEnabled = true +} +``` + +The Android Gradle plugin's `logcat.enabled` option controls Logcat bytecode instrumentation. `logcatLogCaptureEnabled` controls whether the instrumented records are also sent as Sentry Logs. diff --git a/docs/platforms/android/integrations/timber/index.mdx b/docs/platforms/android/integrations/timber/index.mdx index 8e94f0151694de..29c8f24f463f52 100644 --- a/docs/platforms/android/integrations/timber/index.mdx +++ b/docs/platforms/android/integrations/timber/index.mdx @@ -8,7 +8,7 @@ description: "Learn more about the Sentry Timber integration for the Android SDK -This integration captures Timber logs as breadcrumbs and error events (great for error context!). But if you need to search and query your logs across your entire application, use Sentry Logs instead. Timber logs at or above the `minLogsLevel` are automatically sent as Sentry Logs when enabled. See the Support With Sentry Logs section below. +This integration captures Timber logs as breadcrumbs and error events (great for error context!). But if you need to search and query your logs across your entire application, use Sentry Logs instead. Timber logs at or above the `minLogsLevel` are sent as Sentry Logs when Timber log capture is enabled. See the Support With Sentry Logs section below. @@ -74,6 +74,8 @@ implementation 'io.sentry:sentry-android-timber:{{@inject packages.version('sent Configuration should happen as early as possible in your application's lifecycle. ```kotlin +import io.sentry.SentryLevel +import io.sentry.SentryLogLevel import io.sentry.android.core.SentryAndroid import io.sentry.android.timber.SentryTimberIntegration import timber.log.Timber @@ -90,7 +92,8 @@ SentryAndroid.init(this) { options -> SentryTimberIntegration( minEventLevel = SentryLevel.ERROR, minBreadcrumbLevel = SentryLevel.INFO, - minLogsLevel = SentryLogLevel.INFO + minLogsLevel = SentryLogLevel.INFO, + logsEnabled = false ) ) } else { @@ -100,9 +103,11 @@ SentryAndroid.init(this) { options -> ``` ```java +import io.sentry.SentryLevel; +import io.sentry.SentryLogLevel; import io.sentry.android.core.SentryAndroid; import io.sentry.android.timber.SentryTimberIntegration; -import timber.log.Timber +import timber.log.Timber; // import BuildConfig SentryAndroid.init(this, options -> { @@ -116,7 +121,8 @@ SentryAndroid.init(this, options -> { new SentryTimberIntegration( SentryLevel.ERROR, SentryLevel.INFO, - SentryLogLevel.INFO + SentryLogLevel.INFO, + false ) ); } else { @@ -181,4 +187,50 @@ Sentry Logs for Timber are supported in Sentry Android SDK version `8.17.0` and -Timber logs at or above the `minLogsLevel` captured by Sentry are automatically sent as Sentry Logs, if enabled. +Automatic Sentry Logs capture from Timber is disabled by default. + +For the auto-installed Timber integration, enable capture in `AndroidManifest.xml`: + +```xml {filename:AndroidManifest.xml} + + + +``` + +Or enable it when initializing the SDK: + +```java {tabTitle:Java} +import io.sentry.android.core.SentryAndroid; + +SentryAndroid.init(this, options -> { + options.setTimberLogCaptureEnabled(true); +}); +``` + +```kotlin {tabTitle:Kotlin} +import io.sentry.android.core.SentryAndroid + +SentryAndroid.init(this) { options -> + options.timberLogCaptureEnabled = true +} +``` + +When manually adding `SentryTimberIntegration`, pass `true` as its `logsEnabled` argument instead: + +```kotlin {tabTitle:Kotlin} +SentryTimberIntegration( + minEventLevel = SentryLevel.ERROR, + minBreadcrumbLevel = SentryLevel.INFO, + minLogsLevel = SentryLogLevel.INFO, + logsEnabled = true +) +``` + +```java {tabTitle:Java} +new SentryTimberIntegration( + SentryLevel.ERROR, + SentryLevel.INFO, + SentryLogLevel.INFO, + true +); +``` diff --git a/docs/platforms/android/manual-setup/index.mdx b/docs/platforms/android/manual-setup/index.mdx index 1e24b688759092..2fc621b6e6ea83 100644 --- a/docs/platforms/android/manual-setup/index.mdx +++ b/docs/platforms/android/manual-setup/index.mdx @@ -84,9 +84,6 @@ Configuration is done via the application `AndroidManifest.xml`. Here's an examp See the Android Session Replay documentation for details: https://docs.sentry.io/platforms/android/session-replay/#screenshot-strategy --> - - - @@ -167,9 +164,6 @@ class MyApplication : Application() { // See the Android Session Replay documentation for details: https://docs.sentry.io/platforms/android/session-replay/#screenshot-strategy // options.sessionReplay.screenshotStrategy = ScreenshotStrategyType.CANVAS - // enable logs to be sent to Sentry. Use Sentry.logger() to capture logs or check the available integrations that capture logs automatically: https://docs.sentry.io/platforms/android/logs/#integrations - options.logs.isEnabled = true - // enable tombstone support for richer Native crashes context. See more at https://docs.sentry.io/platforms/android/configuration/tombstones/ options.isTombstoneEnabled = true @@ -226,9 +220,6 @@ public class MyApplication extends Application { // See the Android Session Replay documentation for details: https://docs.sentry.io/platforms/android/session-replay/#screenshot-strategy // options.getSessionReplay().setScreenshotStrategy(ScreenshotStrategyType.CANVAS); - // enable logs to be sent to Sentry. Use Sentry.logger() to capture logs or check the available integrations that capture logs automatically: https://docs.sentry.io/platforms/android/logs/#integrations - options.getLogs().setEnabled(true); - // enable tombstone support for richer Native crashes context. See more at https://docs.sentry.io/platforms/android/configuration/tombstones/ options.setTombstoneEnabled(true); diff --git a/docs/platforms/android/migration/v8-to-v9.mdx b/docs/platforms/android/migration/v8-to-v9.mdx new file mode 100644 index 00000000000000..e1432a2345878e --- /dev/null +++ b/docs/platforms/android/migration/v8-to-v9.mdx @@ -0,0 +1,48 @@ +--- +title: Migrate from Sentry 8.x to 9.0.0 +description: "Learn how to migrate from Sentry Android SDK 8.x to 9.0.0." +sidebar_order: 8890 +--- + +Version 9 removes the global Logs and Metrics enable options. Manual telemetry APIs now work whenever the SDK is enabled, while automatic Timber and Logcat capture require their own explicit opt-in. + +## Manual Logs and Metrics + +Calls to `Sentry.logger()` and `Sentry.metrics()` no longer require a global enable option. Remove calls to: + +- `options.getLogs().setEnabled(...)` +- `options.getMetrics().setEnabled(...)` + +The `beforeSendLog` and `beforeSendMetric` callbacks remain available for filtering or modifying telemetry. + +## Android Manifest Options + +Remove these manifest entries: + +```xml {filename:AndroidManifest.xml} + + +``` + +To capture logs from an automatic Android integration, use its integration-specific option instead: + +```xml {filename:AndroidManifest.xml} + + +``` + +The equivalent `SentryAndroidOptions` properties are `timberLogCaptureEnabled` and `logcatLogCaptureEnabled`. Both default to `false`. + +## Timber Constructor Changes + +Manual `SentryTimberIntegration` and `SentryTimberTree` construction now requires a `logsEnabled` argument. Pass `false` to keep automatic Sentry Logs capture disabled: + +```kotlin {tabTitle:Kotlin} +SentryTimberIntegration(logsEnabled = false) +``` + +```java {tabTitle:Java} +new SentryTimberIntegration(false); +``` + +Pass `true` only when Timber records should also be sent as Sentry Logs. diff --git a/docs/platforms/java/common/migration/8.x-to-9.0.mdx b/docs/platforms/java/common/migration/8.x-to-9.0.mdx new file mode 100644 index 00000000000000..436907aec025be --- /dev/null +++ b/docs/platforms/java/common/migration/8.x-to-9.0.mdx @@ -0,0 +1,46 @@ +--- +title: Migrating Version 8.x to 9.0 +description: "Learn how to migrate from version 8.x to 9.0 of the Sentry Java SDK." +sidebar_order: 994 +--- + +Version 9 removes the global Logs and Metrics enable options. Manual telemetry APIs now work whenever the SDK is enabled, while automatic logging integrations require their own explicit opt-in. + +## Manual Logs and Metrics + +Calls to `Sentry.logger()` and `Sentry.metrics()` no longer require a global enable option. Remove calls to: + +- `options.getLogs().setEnabled(...)` +- `options.getMetrics().setEnabled(...)` + +The `beforeSendLog` and `beforeSendMetric` callbacks remain available for filtering or modifying telemetry. + +## Removed External Configuration + +Remove these options from your configuration: + +| Configuration | Removed Logs Option | Removed Metrics Option | +| -------------------- | --------------------- | ------------------------ | +| `sentry.properties` | `logs.enabled` | `metrics.enabled` | +| Java system property | `sentry.logs.enabled` | `sentry.metrics.enabled` | +| Environment variable | `SENTRY_LOGS_ENABLED` | `SENTRY_METRICS_ENABLED` | +| Spring Boot | `sentry.logs.enabled` | `sentry.metrics.enabled` | + +Metrics are sent only when your application calls `Sentry.metrics()`. To discard selected metrics, use `beforeSendMetric`. + +## Automatic Logging Integrations + +Automatic Sentry Logs capture is disabled by default. Enable it on each logging integration that should forward records: + +| Integration | Version 9 Opt-In | +| -------------------------------------- | --------------------------------------------------------- | +| Logback | Set `true` on `SentryAppender` | +| Log4j 2 | Set `logsEnabled="true"` on the `` appender | +| `java.util.logging` | Set `io.sentry.jul.SentryHandler.logsEnabled=true` | +| Spring Boot logging auto-configuration | Set `sentry.logging.logs-enabled=true` | + +The minimum-level options only select eligible records. They do not enable Sentry Logs capture. + +## Constructor Changes + +The Log4j 2 `SentryAppender` constructor and `createAppender` factory now require a `logsEnabled` argument. Pass `true` to capture Sentry Logs or `false` to keep capture disabled. The deprecated constructor without `minimumLevel` has been removed. diff --git a/docs/platforms/java/guides/jul/configuration/configuration-example.mdx b/docs/platforms/java/guides/jul/configuration/configuration-example.mdx index 674fdf1e6cb1f2..12c9151768a988 100644 --- a/docs/platforms/java/guides/jul/configuration/configuration-example.mdx +++ b/docs/platforms/java/guides/jul/configuration/configuration-example.mdx @@ -14,5 +14,7 @@ Configuration options specific to `java.util.logging` integration can be configu io.sentry.jul.SentryHandler.level=CONFIG io.sentry.jul.SentryHandler.minimumEventLevel=INFO io.sentry.jul.SentryHandler.minimumBreadcrumbLevel=CONFIG +io.sentry.jul.SentryHandler.logsEnabled=true +io.sentry.jul.SentryHandler.minimumLevel=CONFIG io.sentry.jul.SentryHandler.printfStyle=true ``` diff --git a/docs/platforms/java/guides/spring-boot/logging-frameworks/log4j2.mdx b/docs/platforms/java/guides/spring-boot/logging-frameworks/log4j2.mdx index e5f5e55e960ccd..3f5f5b4f860b25 100644 --- a/docs/platforms/java/guides/spring-boot/logging-frameworks/log4j2.mdx +++ b/docs/platforms/java/guides/spring-boot/logging-frameworks/log4j2.mdx @@ -7,7 +7,7 @@ For the best experience, we recommend using Sentry's Spring Boot integration wit -By default this integration captures logs as breadcrumbs and error events (great for error context!). But if you need to search and query your logs across your entire application, we recommend enabling the new logs feature. Logs at or above the `minimumLevel` are automatically sent as Sentry Logs when enabled. +By default this integration captures logs as breadcrumbs and error events (great for error context!). To search and query logs across your application, enable Sentry Logs capture with `sentry.logging.logs-enabled`. Records at or above `minimumLevel` are then sent as Sentry Logs. @@ -39,10 +39,10 @@ For other dependency managers see the [central Maven repository](https://search. ### Spring Boot Configuration -To send logs to Sentry and have them show up in the Logs section, you need to enable the feature: +To send Log4j 2 records to Sentry Logs, enable log capture for the auto-configured appender: ```properties -sentry.logs.enabled=true +sentry.logging.logs-enabled=true ``` For Spring Boot 3 and 4, Sentry can register `SentryAppender` for you once the application context refreshes. This auto-configuration is opt-in: @@ -88,7 +88,7 @@ Spring Boot 2 doesn't support `SentryAppender` auto-configuration, and errors lo - + diff --git a/docs/platforms/java/guides/spring-boot/logging-frameworks/logback.mdx b/docs/platforms/java/guides/spring-boot/logging-frameworks/logback.mdx index 273979e2b298ab..4a5e29f2a63661 100644 --- a/docs/platforms/java/guides/spring-boot/logging-frameworks/logback.mdx +++ b/docs/platforms/java/guides/spring-boot/logging-frameworks/logback.mdx @@ -9,7 +9,7 @@ For the best experience, we recommend using Sentry's Spring Boot integration wit -By default this integration captures logs as breadcrumbs and error events (great for error context!). But if you need to search and query your logs across your entire application, we recommend enabling the new logs feature. Logs at or above the `sentry.logging.minimum-level` are automatically sent as Sentry Logs when enabled. +By default this integration captures logs as breadcrumbs and error events (great for error context!). To search and query logs across your application, enable Sentry Logs capture with `sentry.logging.logs-enabled`. Records at or above `sentry.logging.minimum-level` are then sent as Sentry Logs. @@ -33,10 +33,10 @@ implementation 'io.sentry:sentry-logback:{{@inject packages.version('sentry.java ### Spring Boot Configuration -To send logs to Sentry and have them show up in the Logs section, you need to enable the feature: +To send Logback records to Sentry Logs, enable log capture for the auto-configured appender: ```properties -sentry.logs.enabled=true +sentry.logging.logs-enabled=true ``` Minimum logging levels for `SentryAppender` can be configured in `application.properties` or `application.yml` file. @@ -70,6 +70,7 @@ If you decide to opt-out from the `application.properties` based Spring Boot log + true INFO diff --git a/platform-includes/getting-started-config/java.jul.mdx b/platform-includes/getting-started-config/java.jul.mdx index b9fa7348381f38..56a285f5bd6b69 100644 --- a/platform-includes/getting-started-config/java.jul.mdx +++ b/platform-includes/getting-started-config/java.jul.mdx @@ -19,6 +19,10 @@ handlers=java.util.logging.ConsoleHandler,io.sentry.jul.SentryHandler # Override the Sentry handler log level to WARNING io.sentry.jul.SentryHandler.level=WARNING + +# Enable automatic Sentry Logs capture +io.sentry.jul.SentryHandler.logsEnabled=true + ``` When starting your application, add the `java.util.logging.config.file` to the system properties, with the full path to the `logging.properties` as its value: @@ -39,10 +43,6 @@ dsn=___PUBLIC_DSN___ # 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 - ``` @@ -67,6 +67,10 @@ Breadcrumbs are kept in memory (by default the last 100 records) and are sent wi ```properties {tabTitle:logging.properties} io.sentry.jul.SentryHandler.minimumEventLevel=INFO io.sentry.jul.SentryHandler.minimumBreadcrumbLevel=CONFIG + +io.sentry.jul.SentryHandler.logsEnabled=true +io.sentry.jul.SentryHandler.minimumLevel=CONFIG + io.sentry.jul.SentryHandler.level=CONFIG ... ``` diff --git a/platform-includes/getting-started-config/java.log4j2.mdx b/platform-includes/getting-started-config/java.log4j2.mdx index 21571683b485ff..3d44fea81d7556 100644 --- a/platform-includes/getting-started-config/java.log4j2.mdx +++ b/platform-includes/getting-started-config/java.log4j2.mdx @@ -17,7 +17,12 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se - + + logsEnabled="true" + + /> @@ -40,7 +45,11 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se - + + logsEnabled="true" + + /> @@ -72,9 +81,6 @@ If the DSN is not present in the `log4j2.xml` configuration, Sentry will attempt # 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 ``` @@ -105,6 +111,7 @@ Breadcrumbs are kept in memory (by default the last 100 records) and are sent wi minimumBreadcrumbLevel="DEBUG" minimumEventLevel="WARN" + logsEnabled="true" minimumLevel="DEBUG" /> @@ -118,6 +125,7 @@ Breadcrumbs are kept in memory (by default the last 100 records) and are sent wi minimumBreadcrumbLevel="DEBUG" minimumEventLevel="WARN" + logsEnabled="true" minimumLevel="DEBUG" /> diff --git a/platform-includes/getting-started-config/java.logback.mdx b/platform-includes/getting-started-config/java.logback.mdx index c68dff686d8761..0a4085c3a98939 100644 --- a/platform-includes/getting-started-config/java.logback.mdx +++ b/platform-includes/getting-started-config/java.logback.mdx @@ -20,13 +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 - + // ___PRODUCT_OPTION_START___ logs + true + // ___PRODUCT_OPTION_END___ logs - + + // ___PRODUCT_OPTION_START___ logs + true + // ___PRODUCT_OPTION_END___ logs + @@ -105,7 +105,8 @@ Breadcrumbs are kept in memory (by default the last 100 records) and are sent wi DEBUG // ___PRODUCT_OPTION_START___ logs - + + true DEBUG // ___PRODUCT_OPTION_END___ logs @@ -120,7 +121,8 @@ Breadcrumbs are kept in memory (by default the last 100 records) and are sent wi DEBUG // ___PRODUCT_OPTION_START___ logs - + + true DEBUG // ___PRODUCT_OPTION_END___ logs diff --git a/platform-includes/getting-started-config/java.mdx b/platform-includes/getting-started-config/java.mdx index 2acface3c9a9e0..a50668ac0c581d 100644 --- a/platform-includes/getting-started-config/java.mdx +++ b/platform-includes/getting-started-config/java.mdx @@ -25,11 +25,6 @@ Sentry.init(options -> { 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 }); ``` @@ -57,11 +52,6 @@ Sentry.init { options -> 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 } ``` diff --git a/platform-includes/getting-started-config/java.servlet.mdx b/platform-includes/getting-started-config/java.servlet.mdx index cbcc3debdb2e12..ee0e738bec21e3 100644 --- a/platform-includes/getting-started-config/java.servlet.mdx +++ b/platform-includes/getting-started-config/java.servlet.mdx @@ -36,11 +36,6 @@ public final class SentryInitializer implements ServletContainerInitializer { 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 }); } } @@ -77,11 +72,6 @@ class SentryInitializer : ServletContainerInitializer { 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 } } } diff --git a/platform-includes/getting-started-config/java.spring-boot.mdx b/platform-includes/getting-started-config/java.spring-boot.mdx index 83df69f0e8d542..43fe0202e64965 100644 --- a/platform-includes/getting-started-config/java.spring-boot.mdx +++ b/platform-includes/getting-started-config/java.spring-boot.mdx @@ -25,8 +25,8 @@ sentry.profile-lifecycle=TRACE // ___PRODUCT_OPTION_END___ profiling // ___PRODUCT_OPTION_START___ logs -# Enable logs -sentry.logs.enabled=true +# Enable automatic Sentry Logs capture from the configured logging framework +sentry.logging.logs-enabled=true // ___PRODUCT_OPTION_END___ logs ``` @@ -54,9 +54,9 @@ sentry: // ___PRODUCT_OPTION_END___ profiling // ___PRODUCT_OPTION_START___ logs - # Enable logs - logs: - enabled: true + # Enable automatic Sentry Logs capture from the configured logging framework + logging: + logs-enabled: true // ___PRODUCT_OPTION_END___ logs ``` diff --git a/platform-includes/getting-started-config/java.spring.mdx b/platform-includes/getting-started-config/java.spring.mdx index b0682f6a21e837..f81f58fe7f188b 100644 --- a/platform-includes/getting-started-config/java.spring.mdx +++ b/platform-includes/getting-started-config/java.spring.mdx @@ -175,8 +175,12 @@ traces-sample-rate=1.0 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 ``` + + + + +Calls to `Sentry.logger()` send logs without additional configuration. To capture logging framework records automatically, configure the applicable logging integration. + + + diff --git a/platform-includes/getting-started-config/opentelemetry/java.mdx b/platform-includes/getting-started-config/opentelemetry/java.mdx index 083b36ef8c2eb7..b2e5215806ab18 100644 --- a/platform-includes/getting-started-config/opentelemetry/java.mdx +++ b/platform-includes/getting-started-config/opentelemetry/java.mdx @@ -11,9 +11,6 @@ data-collection.user-info=false # ___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 diff --git a/platform-includes/logs/setup/android.mdx b/platform-includes/logs/setup/android.mdx index 7a231888ad31aa..a103de99af0d53 100644 --- a/platform-includes/logs/setup/android.mdx +++ b/platform-includes/logs/setup/android.mdx @@ -1,38 +1,3 @@ -To enable logging integrations, you need to initialize the SDK with the `logs.enabled` option set to `true`. Since SDK version 8.59.0, direct `Sentry.logger()` calls don't require this option. +After you initialize the SDK, calls to `Sentry.logger()` send logs without additional configuration. -```XML {filename:AndroidManifest.xml} - -``` - -```java {tabTitle: Java} {10} -import io.sentry.SentryLevel; -import io.sentry.android.core.SentryAndroid; -import android.app.Application; - -public class MyApplication extends Application { - public void onCreate() { - super.onCreate(); - SentryAndroid.init(this, options -> { - options.setDsn("___PUBLIC_DSN___"); - options.getLogs().setEnabled(true); - }); - } -} -``` - -```kotlin {tabTitle: Kotlin} {11} -import io.sentry.android.core.SentryAndroid -import io.sentry.SentryOptions.BeforeSendCallback -import io.sentry.Hint -import android.app.Application - -class MyApplication : Application() { - override fun onCreate() { - super.onCreate() - SentryAndroid.init(this) { options -> - options.dsn = "___PUBLIC_DSN___" - options.logs.enabled = true - } - } -} -``` +To capture Timber or Logcat output automatically, enable log capture for the applicable logging integration. diff --git a/platform-includes/logs/setup/java.jul.mdx b/platform-includes/logs/setup/java.jul.mdx index 5ecd3ab817ad65..7ced10ab351838 100644 --- a/platform-includes/logs/setup/java.jul.mdx +++ b/platform-includes/logs/setup/java.jul.mdx @@ -1,32 +1,12 @@ -To enable logging, you need to configure the option in `sentry.properties` or when calling `Sentry.init`. +Enable Sentry Logs on the handler with `logsEnabled`. Use `minimumLevel` to configure which log messages are sent to Sentry. -```properties {tabTitle: sentry.properties} {mdExpandTabs} -logs.enabled=true -``` - -```java {tabTitle: Sentry.init (Java)} {5} -import io.sentry.Sentry; - -Sentry.init(options -> { - options.setDsn("___PUBLIC_DSN___"); - options.getLogs().setEnabled(true); -}); -``` - -```kotlin {tabTitle: Sentry.init(Kotlin)} {5} -import io.sentry.Sentry - -Sentry.init { options -> - options.dsn = "___PUBLIC_DSN___" - options.logs.enabled = true -} -``` - -You may also configure the Sentry handler and set `minimumLevel` in `logging.properties`: - -```properties {tabTitle: logging.properties} {5} +```properties {tabTitle: logging.properties} {5,8} # Configure the Sentry handler handlers=io.sentry.jul.SentryHandler -# Set the minimum level for Sentry handler -io.sentry.jul.SentryHandler.minimumLevel=CONFIG \ No newline at end of file +# Enable Sentry Logs capture +io.sentry.jul.SentryHandler.logsEnabled=true + +# Set the minimum level for the Sentry handler +io.sentry.jul.SentryHandler.minimumLevel=CONFIG +``` diff --git a/platform-includes/logs/setup/java.log4j2.mdx b/platform-includes/logs/setup/java.log4j2.mdx index 18b9dd50add330..d9988114279a7f 100644 --- a/platform-includes/logs/setup/java.log4j2.mdx +++ b/platform-includes/logs/setup/java.log4j2.mdx @@ -1,35 +1,12 @@ -To enable logging, you need to configure the option in `sentry.properties` or when calling `Sentry.init`. +Enable Sentry Logs on the appender with `logsEnabled`. Use `minimumLevel` to configure which log messages are sent to Sentry. -```properties {tabTitle: sentry.properties} {mdExpandTabs} -logs.enabled=true -``` - -```java {tabTitle: Sentry.init (Java)} {5} -import io.sentry.Sentry; - -Sentry.init(options -> { - options.setDsn("___PUBLIC_DSN___"); - options.getLogs().setEnabled(true); -}); -``` - -```kotlin {tabTitle: Sentry.init(Kotlin)} {5} -import io.sentry.Sentry - -Sentry.init { options -> - options.dsn = "___PUBLIC_DSN___" - options.logs.enabled = true -} -``` - -You may also set `minimumLevel` in `log4j2.xml` to configure which log messages are sent to Sentry. - -```xml {tabTitle: log4j2.xml} {6} +```xml {tabTitle: log4j2.xml} {4,7} -``` \ No newline at end of file +``` diff --git a/platform-includes/logs/setup/java.logback.mdx b/platform-includes/logs/setup/java.logback.mdx index cdb064e0dd0ded..39dfa8717119ee 100644 --- a/platform-includes/logs/setup/java.logback.mdx +++ b/platform-includes/logs/setup/java.logback.mdx @@ -1,14 +1,12 @@ -To enable logging, you need to configure the option in the appender configuration. You may also set `minimumLevel` to configure which log messages are sent to Sentry. +Enable Sentry Logs on the appender with `logsEnabled`. Use `minimumLevel` to configure which log messages are sent to Sentry. -```xml {tabTitle: logback.xml} {5-7,15} +```xml {tabTitle: logback.xml} {7,15} ___PUBLIC_DSN___ - - true - + true WARN @@ -17,4 +15,4 @@ To enable logging, you need to configure the option in the appender configuratio DEBUG -``` \ No newline at end of file +``` diff --git a/platform-includes/logs/setup/java.mdx b/platform-includes/logs/setup/java.mdx index c7ded08d2531dd..a7fc3bad37e5d5 100644 --- a/platform-includes/logs/setup/java.mdx +++ b/platform-includes/logs/setup/java.mdx @@ -1,19 +1 @@ -To enable logging integrations, you need to initialize the SDK with the `logs.enabled` option set to `true`. Since SDK version 8.59.0, direct `Sentry.logger()` calls don't require this option. - -```java {tabTitle: Java} {5} -import io.sentry.Sentry; - -Sentry.init(options -> { - options.setDsn("___PUBLIC_DSN___"); - options.getLogs().setEnabled(true); -}); -``` - -```kotlin {tabTitle: Kotlin} {5} -import io.sentry.Sentry - -Sentry.init { options -> - options.dsn = "___PUBLIC_DSN___" - options.logs.enabled = true -} -``` +After you initialize the SDK, calls to `Sentry.logger()` send logs without additional configuration. diff --git a/platform-includes/logs/setup/java.spring-boot.mdx b/platform-includes/logs/setup/java.spring-boot.mdx index abebb20eeb97c9..65083266b955ad 100644 --- a/platform-includes/logs/setup/java.spring-boot.mdx +++ b/platform-includes/logs/setup/java.spring-boot.mdx @@ -1,10 +1,11 @@ -To enable logging, you have to enable the feature in your Spring configuration file: +Enable automatic Sentry Logs capture for the configured logging framework with `sentry.logging.logs-enabled`: ```properties {tabTitle:application.properties} -sentry.logs.enabled=true +sentry.logging.logs-enabled=true ``` ```yaml {tabTitle:application.yml} sentry: - logs.enabled: true -``` \ No newline at end of file + logging: + logs-enabled: true +``` diff --git a/platform-includes/logs/usage/android.mdx b/platform-includes/logs/usage/android.mdx index 3991f3a7af9590..9ed4bebf0ac9ca 100644 --- a/platform-includes/logs/usage/android.mdx +++ b/platform-includes/logs/usage/android.mdx @@ -1,4 +1,4 @@ -Once the feature is enabled on the SDK and the SDK is initialized, you can send logs using the `Sentry.logger()` APIs. +Once the SDK is initialized, you can send logs using the `Sentry.logger()` APIs without enabling an additional option. The `Sentry.logger()` namespace exposes six methods that you can use to log messages at different log levels: `trace`, `debug`, `info`, `warn`, `error`, and `fatal`. diff --git a/platform-includes/logs/usage/java.jul.mdx b/platform-includes/logs/usage/java.jul.mdx index 2f63102e77785d..016de1be5b8af1 100644 --- a/platform-includes/logs/usage/java.jul.mdx +++ b/platform-includes/logs/usage/java.jul.mdx @@ -1 +1 @@ -Once the handler is configured with logging enabled, any logs at or above the `minimumLevel` will be sent to Sentry. \ No newline at end of file +After you set `io.sentry.jul.SentryHandler.logsEnabled=true`, records at or above `minimumLevel` are sent as Sentry Logs. diff --git a/platform-includes/logs/usage/java.log4j2.mdx b/platform-includes/logs/usage/java.log4j2.mdx index 2f63102e77785d..d9ee5f66cf52fd 100644 --- a/platform-includes/logs/usage/java.log4j2.mdx +++ b/platform-includes/logs/usage/java.log4j2.mdx @@ -1 +1 @@ -Once the handler is configured with logging enabled, any logs at or above the `minimumLevel` will be sent to Sentry. \ No newline at end of file +After you set `logsEnabled="true"` on the appender, records at or above `minimumLevel` are sent as Sentry Logs. diff --git a/platform-includes/logs/usage/java.logback.mdx b/platform-includes/logs/usage/java.logback.mdx index 4c3f1b96cb6a3f..42dee74476dc1e 100644 --- a/platform-includes/logs/usage/java.logback.mdx +++ b/platform-includes/logs/usage/java.logback.mdx @@ -1 +1 @@ -Once the appender has been configured with logs enabled any logs equal to or higher than `minimumLevel` will be sent to Sentry as logs. \ No newline at end of file +After you set `logsEnabled` to `true` on the appender, records at or above `minimumLevel` are sent as Sentry Logs. diff --git a/platform-includes/logs/usage/java.mdx b/platform-includes/logs/usage/java.mdx index a0233f9b5deb67..998c0046cb8b91 100644 --- a/platform-includes/logs/usage/java.mdx +++ b/platform-includes/logs/usage/java.mdx @@ -1,4 +1,4 @@ -Once the feature is enabled on the SDK and the SDK is initialized, you can send logs using the `Sentry.logger()` APIs. +Once the SDK is initialized, you can send logs using the `Sentry.logger()` APIs without enabling an additional option. The `Sentry.logger()` namespace exposes six methods that you can use to log messages at different log levels: `trace`, `debug`, `info`, `warn`, `error`, and `fatal`. diff --git a/platform-includes/metrics/options/android.mdx b/platform-includes/metrics/options/android.mdx index 035acd2d5b8817..bb5ddc1807fab8 100644 --- a/platform-includes/metrics/options/android.mdx +++ b/platform-includes/metrics/options/android.mdx @@ -1,4 +1,4 @@ -The Sentry Android SDK provides several options to configure how metrics are captured and sent to Sentry. +The Sentry Android SDK provides several options to configure how metrics are captured and sent to Sentry. Calls to `Sentry.metrics()` send metrics whenever the SDK is enabled; there is no global Metrics enable option. ### Filtering and Modifying Metrics @@ -55,31 +55,3 @@ SentryAndroid.init(context) { options -> } } ``` - -### Disabling Metrics - -Since SDK version 8.59.0, the `metrics.enabled` flag no longer affects metrics; use `beforeSend` to drop them instead. In older versions, you can disable metrics collection entirely by disabling the `metrics.enabled` flag: - -```xml {tabTitle: XML} {mdExpandTabs} - -``` -```java {tabTitle: Java} -import io.sentry.android.core.SentryAndroid; -import io.sentry.android.core.SentryAndroidOptions; - -SentryAndroid.init(context, - options -> { - // ... - options.getMetrics().setEnabled(false); - } -); -``` -```kotlin {tabTitle: Kotlin} -import io.sentry.android.core.SentryAndroid -import io.sentry.android.core.SentryAndroidOptions - -SentryAndroid.init { options -> - // ... - options.metrics.setEnabled(false) -} -``` diff --git a/platform-includes/metrics/options/java.mdx b/platform-includes/metrics/options/java.mdx index 90917554880cf7..3e0957292b6dfb 100644 --- a/platform-includes/metrics/options/java.mdx +++ b/platform-includes/metrics/options/java.mdx @@ -1,4 +1,4 @@ -The Sentry Java SDK provides several options to configure how metrics are captured and sent to Sentry. +The Sentry Java SDK provides several options to configure how metrics are captured and sent to Sentry. Calls to `Sentry.metrics()` send metrics whenever the SDK is enabled; there is no global Metrics enable option. ### Filtering and Modifying Metrics @@ -53,26 +53,3 @@ Sentry.init { options -> } } ``` - -### Disabling Metrics - -Since SDK version 8.59.0, the `metrics.enabled` flag no longer affects metrics; use `beforeSend` to drop them instead. In older versions, you can disable metrics collection entirely by disabling the `metrics.enabled` flag: - -```java {tabTitle: Java} -import io.sentry.Sentry; - -Sentry.init( - options -> { - // ... - options.getMetrics().setEnabled(false); - } -); -``` -```kotlin {tabTitle: Kotlin} -import io.sentry.Sentry - -Sentry.init { options -> - // ... - options.metrics.setEnabled(false) -} -``` \ No newline at end of file diff --git a/platform-includes/metrics/options/java.spring-boot.mdx b/platform-includes/metrics/options/java.spring-boot.mdx index 25f84c84c0500f..b94414f54fbe4b 100644 --- a/platform-includes/metrics/options/java.spring-boot.mdx +++ b/platform-includes/metrics/options/java.spring-boot.mdx @@ -56,17 +56,6 @@ class SentryMetricsConfiguration { } ``` -The `beforeSend` function receives a metric object, and should return the metric object if you want it to be sent to Sentry, or `null` if you want to discard it. +The `beforeSend` function receives a metric object. Return the metric to send it to Sentry, or return `null` to discard it. -### Disabling Metrics - -Since SDK version 8.59.0, the `metrics.enabled` flag no longer affects metrics; use `beforeSend` to drop them instead. In older versions, you can disable metrics collection entirely by disabling the `metrics.enabled` flag: - -```properties {tabTitle:application.properties} -sentry.metrics.enabled=false -``` -```yaml {tabTitle:application.yml} -sentry: - metrics: - enabled: false -``` +Calls to `Sentry.metrics()` send metrics whenever the SDK is enabled; there is no global Metrics enable option.