Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/get-started/guides/logs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,6 @@ SentryAndroid.init(context) { options ->
options.dsn = "..."
options.environment = "development"
options.tracesSampleRate = 1.0 // 100% of traces
options.logs.enabled = true
}
```

Expand Down
12 changes: 8 additions & 4 deletions docs/platforms/android/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ Configuration is done via the application `AndroidManifest.xml`. Here's an examp
<!-- Set profiling lifecycle, can be `manual` (controlled through `Sentry.startProfiler()` and `Sentry.stopProfiler()`) or `trace` (automatically starts and stop a profile whenever a sampled trace starts and finishes) -->
<meta-data android:name="io.sentry.traces.profiling.lifecycle" android:value="trace" />
<!-- ___PRODUCT_OPTION_END___ profiling -->
<!-- ___PRODUCT_OPTION_START___ logs -->
<!-- Enable logs to be sent to Sentry -->
<meta-data android:name="io.sentry.logs.enabled" android:value="true" />
<!-- ___PRODUCT_OPTION_END___ logs -->
<!-- ___PRODUCT_OPTION_START___ session-replay -->
<!-- Record session replays for 100% of errors and 10% of sessions -->
<meta-data android:name="io.sentry.session-replay.on-error-sample-rate" android:value="1.0" />
Expand All @@ -142,6 +138,14 @@ Configuration is done via the application `AndroidManifest.xml`. Here's an examp
</application>
```

<OnboardingOption optionId="logs">
<Alert>

Calls to `Sentry.logger()` send logs without additional configuration. To capture Timber or Logcat output automatically, enable log capture for the applicable <PlatformLink to="/logs/#other-logging-integrations">logging integration</PlatformLink>.

</Alert>
</OnboardingOption>

## 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.
Expand Down
30 changes: 28 additions & 2 deletions docs/platforms/android/integrations/logcat/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ og_image: /og-images/platforms-android-integrations-logcat.png

<Alert level="warning" title="Did you mean logs instead?">

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 <PlatformLink to="/logs/">Sentry Logs</PlatformLink> instead. Logcat logs at or above the `minLevel` are automatically sent as Sentry Logs when enabled. See the <PlatformLink to="/integrations/logcat/#support-with-sentry-logs">Support With Sentry Logs</PlatformLink> 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 <PlatformLink to="/logs/">Sentry Logs</PlatformLink> instead. Logcat logs at or above the `minLevel` are sent as Sentry Logs when Logcat log capture is enabled. See the <PlatformLink to="/integrations/logcat/#support-with-sentry-logs">Support With Sentry Logs</PlatformLink> section below.

</Alert>

Expand Down Expand Up @@ -135,4 +135,30 @@ Sentry Logs for Logcat are supported in Sentry Android SDK version `8.17.0` and

</Alert>

Logcat logs at or above the `minLevel` captured by Sentry are automatically sent as <PlatformLink to="/logs/">Sentry Logs</PlatformLink>, if enabled.
Automatic Sentry Logs capture from Logcat is disabled by default. Enable it in `AndroidManifest.xml`:

```xml {filename:AndroidManifest.xml}
<application>
<meta-data android:name="io.sentry.logcat.log-capture.enabled" android:value="true" />
</application>
```

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.
62 changes: 57 additions & 5 deletions docs/platforms/android/integrations/timber/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: "Learn more about the Sentry Timber integration for the Android SDK

<Alert level="warning" title="Did you mean logs instead?">

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 <PlatformLink to="/logs/">Sentry Logs</PlatformLink> instead. Timber logs at or above the `minLogsLevel` are automatically sent as Sentry Logs when enabled. See the <PlatformLink to="/integrations/timber/#support-with-sentry-logs">Support With Sentry Logs</PlatformLink> 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 <PlatformLink to="/logs/">Sentry Logs</PlatformLink> instead. Timber logs at or above the `minLogsLevel` are sent as Sentry Logs when Timber log capture is enabled. See the <PlatformLink to="/integrations/timber/#support-with-sentry-logs">Support With Sentry Logs</PlatformLink> section below.

</Alert>

Expand Down Expand Up @@ -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
Expand All @@ -90,7 +92,8 @@ SentryAndroid.init(this) { options ->
SentryTimberIntegration(
minEventLevel = SentryLevel.ERROR,
minBreadcrumbLevel = SentryLevel.INFO,
minLogsLevel = SentryLogLevel.INFO
minLogsLevel = SentryLogLevel.INFO,
logsEnabled = false
)
)
} else {
Expand All @@ -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 -> {
Expand All @@ -116,7 +121,8 @@ SentryAndroid.init(this, options -> {
new SentryTimberIntegration(
SentryLevel.ERROR,
SentryLevel.INFO,
SentryLogLevel.INFO
SentryLogLevel.INFO,
false
)
);
} else {
Expand Down Expand Up @@ -181,4 +187,50 @@ Sentry Logs for Timber are supported in Sentry Android SDK version `8.17.0` and

</Alert>

Timber logs at or above the `minLogsLevel` captured by Sentry are automatically sent as <PlatformLink to="/logs/">Sentry Logs</PlatformLink>, 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}
<application>
<meta-data android:name="io.sentry.timber.log-capture.enabled" android:value="true" />
</application>
```

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
);
```
9 changes: 0 additions & 9 deletions docs/platforms/android/manual-setup/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->
<!-- <meta-data android:name="io.sentry.session-replay.screenshot-strategy" android:value="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 -->
<meta-data android:name="io.sentry.logs.enabled" android:value="true" />

<!-- enable tombstone support for richer Native crashes context. See more at https://docs.sentry.io/platforms/android/configuration/tombstones/ -->
<meta-data android:name="io.sentry.tombstone.enable" android:value="true" />
</application>
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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);

Expand Down
48 changes: 48 additions & 0 deletions docs/platforms/android/migration/v8-to-v9.mdx
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.
46 changes: 46 additions & 0 deletions docs/platforms/java/common/migration/8.x-to-9.0.mdx
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.
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For the best experience, we recommend using Sentry's Spring Boot integration wit

<Alert level="warning" title="Logs over Breadcrumbs">

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.

</Alert>

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -88,7 +88,7 @@ Spring Boot 2 doesn't support `SentryAppender` auto-configuration, and errors lo
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<Sentry name="SENTRY" minimumLevel="DEBUG" />
<Sentry name="SENTRY" logsEnabled="true" minimumLevel="DEBUG" />
</Appenders>

<Loggers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For the best experience, we recommend using Sentry's Spring Boot integration wit

<Alert level="warning" title="Logs over Breadcrumbs">

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.

</Alert>

Expand All @@ -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.
Expand Down Expand Up @@ -70,6 +70,7 @@ If you decide to opt-out from the `application.properties` based Spring Boot log
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />

<appender name="SENTRY" class="io.sentry.logback.SentryAppender">
<logsEnabled>true</logsEnabled>
<minimumLevel>INFO</minimumLevel>
</appender>

Expand Down
Loading
Loading