Repository navigation
docs(java): Update Logs and Metrics configuration for v9 #19962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
564b225
docs(java): Update Logs and Metrics configuration for v9
adinauer 4a82c69
Merge branch 'java-v9' into docs/java-android-logs-metrics-v9
adinauer cb6137b
Merge branch 'java-v9' into docs/java-android-logs-metrics-v9
adinauer ed7b0aa
Merge branch 'java-v9' into docs/java-android-logs-metrics-v9
adinauer 540f95f
Merge branch 'java-v9' into docs/java-android-logs-metrics-v9
adinauer f2a477e
Update platform-includes/getting-started-config/java.spring.mdx
adinauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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} | ||
| <meta-data android:name="io.sentry.logs.enabled" android:value="true" /> | ||
| <meta-data android:name="io.sentry.metrics.enabled" android:value="false" /> | ||
| ``` | ||
|
|
||
| To capture logs from an automatic Android integration, use its integration-specific option instead: | ||
|
|
||
| ```xml {filename:AndroidManifest.xml} | ||
| <meta-data android:name="io.sentry.timber.log-capture.enabled" android:value="true" /> | ||
| <meta-data android:name="io.sentry.logcat.log-capture.enabled" android:value="true" /> | ||
| ``` | ||
|
|
||
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 `<logsEnabled>true</logsEnabled>` on `SentryAppender` | | ||
| | Log4j 2 | Set `logsEnabled="true"` on the `<Sentry>` 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯