From 4ba9818656512bf2165d9ccf01fe7222f95063e7 Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Tue, 8 Jul 2025 14:19:55 +0200 Subject: [PATCH 1/4] Added Logcat and Timber Logs integrations Added minLogsLevel to SentryTimberIntegration --- .../android/integrations/timber/index.mdx | 8 +- .../logs/integrations/android.logcat.mdx | 4 + .../logs/integrations/android.mdx | 4 +- .../logs/integrations/android.timber.mdx | 4 + .../logs/options/android.logcat.mdx | 47 ++++++++++++ .../logs/options/android.timber.mdx | 47 ++++++++++++ .../logs/requirements/android.logcat.mdx | 1 + .../logs/requirements/android.mdx | 2 +- .../logs/requirements/android.timber.mdx | 1 + .../logs/setup/android.logcat.mdx | 75 +++++++++++++++++++ .../logs/setup/android.timber.mdx | 42 +++++++++++ .../logs/usage/android.logcat.mdx | 1 + .../logs/usage/android.timber.mdx | 1 + 13 files changed, 232 insertions(+), 5 deletions(-) create mode 100644 platform-includes/logs/integrations/android.logcat.mdx create mode 100644 platform-includes/logs/integrations/android.timber.mdx create mode 100644 platform-includes/logs/options/android.logcat.mdx create mode 100644 platform-includes/logs/options/android.timber.mdx create mode 100644 platform-includes/logs/requirements/android.logcat.mdx create mode 100644 platform-includes/logs/requirements/android.timber.mdx create mode 100644 platform-includes/logs/setup/android.logcat.mdx create mode 100644 platform-includes/logs/setup/android.timber.mdx create mode 100644 platform-includes/logs/usage/android.logcat.mdx create mode 100644 platform-includes/logs/usage/android.timber.mdx diff --git a/docs/platforms/android/integrations/timber/index.mdx b/docs/platforms/android/integrations/timber/index.mdx index 153c887bfdef6..e4205251fddc1 100644 --- a/docs/platforms/android/integrations/timber/index.mdx +++ b/docs/platforms/android/integrations/timber/index.mdx @@ -79,10 +79,12 @@ SentryAndroid.init(this) { options -> // default values: // minEventLevel = ERROR // minBreadcrumbLevel = INFO + // minLogsLevel = SentryLogLevel.INFO, options.addIntegration( SentryTimberIntegration( minEventLevel = SentryLevel.ERROR, - minBreadcrumbLevel = SentryLevel.INFO + minBreadcrumbLevel = SentryLevel.INFO, + minLogsLevel = SentryLogLevel.INFO ) ) } else { @@ -103,10 +105,12 @@ SentryAndroid.init(this, options -> { // default values: // minEventLevel = ERROR // minBreadcrumbLevel = INFO + // minLogsLevel = SentryLogLevel.INFO, options.addIntegration( new SentryTimberIntegration( SentryLevel.ERROR, - SentryLevel.INFO + SentryLevel.INFO, + SentryLogLevel.INFO ) ); } else { diff --git a/platform-includes/logs/integrations/android.logcat.mdx b/platform-includes/logs/integrations/android.logcat.mdx new file mode 100644 index 0000000000000..b82781c1a6ef1 --- /dev/null +++ b/platform-includes/logs/integrations/android.logcat.mdx @@ -0,0 +1,4 @@ +We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see. + +- [Timber](platforms/android/guides/timber/logs/) +- [Logcat](platforms/android/guides/logcat/logs/) diff --git a/platform-includes/logs/integrations/android.mdx b/platform-includes/logs/integrations/android.mdx index 56cb253f37ab2..b82781c1a6ef1 100644 --- a/platform-includes/logs/integrations/android.mdx +++ b/platform-includes/logs/integrations/android.mdx @@ -1,4 +1,4 @@ We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see. -- [Timber](https://github.com/getsentry/sentry-java/issues/4407) -- [Logcat](https://github.com/getsentry/sentry-java/issues/4408) +- [Timber](platforms/android/guides/timber/logs/) +- [Logcat](platforms/android/guides/logcat/logs/) diff --git a/platform-includes/logs/integrations/android.timber.mdx b/platform-includes/logs/integrations/android.timber.mdx new file mode 100644 index 0000000000000..b82781c1a6ef1 --- /dev/null +++ b/platform-includes/logs/integrations/android.timber.mdx @@ -0,0 +1,4 @@ +We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see. + +- [Timber](platforms/android/guides/timber/logs/) +- [Logcat](platforms/android/guides/logcat/logs/) diff --git a/platform-includes/logs/options/android.logcat.mdx b/platform-includes/logs/options/android.logcat.mdx new file mode 100644 index 0000000000000..fe8b720ea5617 --- /dev/null +++ b/platform-includes/logs/options/android.logcat.mdx @@ -0,0 +1,47 @@ +#### beforeSendLog + +To filter logs, or update them before they are sent to Sentry, you can use the `getLogs().beforeSend` option. + +```java {tabTitle: Java} {10-14} +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().setBeforeSend((logEvent) -> { + // Modify the event here: + logEvent.setBody("new message body"); + return logEvent; + }); + }); + } +} +``` + +```kotlin {tabTitle: Kotlin} {11-15} +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.beforeSend = BeforeSendLogCallback { logEvent -> + // Modify the event here: + logEvent.body = "new message body" + return logEvent; + } + } + } +} +``` + + +The `beforeSend` function receives a log object, and should return the log object if you want it to be sent to Sentry, or `null` if you want to discard it. diff --git a/platform-includes/logs/options/android.timber.mdx b/platform-includes/logs/options/android.timber.mdx new file mode 100644 index 0000000000000..fe8b720ea5617 --- /dev/null +++ b/platform-includes/logs/options/android.timber.mdx @@ -0,0 +1,47 @@ +#### beforeSendLog + +To filter logs, or update them before they are sent to Sentry, you can use the `getLogs().beforeSend` option. + +```java {tabTitle: Java} {10-14} +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().setBeforeSend((logEvent) -> { + // Modify the event here: + logEvent.setBody("new message body"); + return logEvent; + }); + }); + } +} +``` + +```kotlin {tabTitle: Kotlin} {11-15} +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.beforeSend = BeforeSendLogCallback { logEvent -> + // Modify the event here: + logEvent.body = "new message body" + return logEvent; + } + } + } +} +``` + + +The `beforeSend` function receives a log object, and should return the log object if you want it to be sent to Sentry, or `null` if you want to discard it. diff --git a/platform-includes/logs/requirements/android.logcat.mdx b/platform-includes/logs/requirements/android.logcat.mdx new file mode 100644 index 0000000000000..d6428ba4579b8 --- /dev/null +++ b/platform-includes/logs/requirements/android.logcat.mdx @@ -0,0 +1 @@ +Logs for Logcat are supported in Sentry Android SDK version `8.17.0` and above. diff --git a/platform-includes/logs/requirements/android.mdx b/platform-includes/logs/requirements/android.mdx index 92b174e19f6b1..028c37f357714 100644 --- a/platform-includes/logs/requirements/android.mdx +++ b/platform-includes/logs/requirements/android.mdx @@ -1 +1 @@ -Logs for Android are supported in Sentry Java SDK version `8.12.0` and above. +Logs for Android are supported in Sentry Android SDK version `8.12.0` and above. diff --git a/platform-includes/logs/requirements/android.timber.mdx b/platform-includes/logs/requirements/android.timber.mdx new file mode 100644 index 0000000000000..53a8117938a41 --- /dev/null +++ b/platform-includes/logs/requirements/android.timber.mdx @@ -0,0 +1 @@ +Logs for Timber are supported in Sentry Android SDK version `8.17.0` and above. diff --git a/platform-includes/logs/setup/android.logcat.mdx b/platform-includes/logs/setup/android.logcat.mdx new file mode 100644 index 0000000000000..17ce3264ca11c --- /dev/null +++ b/platform-includes/logs/setup/android.logcat.mdx @@ -0,0 +1,75 @@ +To enable logging, you need to initialize the SDK with the `logs.enabled` option set to `true`. + +```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 + } + } +} +``` + +```XML {filename:AndroidManifest.xml} + +``` + +You also need to install the Sentry Logcat Integration using the Sentry Android Gradle plugin. This integration captures log messages from the Android logcat and sends them to Sentry. + +You may also set `minLevel` in `build.gradle` to configure which log messages are sent to Sentry. + +```groovy {filename:app/build.gradle} {10} +import io.sentry.android.gradle.extensions.InstrumentationFeature +import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel + +sentry { + tracingInstrumentation { + enabled = true + + logcat { + enabled = true + minLevel = LogcatLevel.WARNING + } + } +} +``` + +```kotlin {filename:app/build.gradle.kts} {11} +import java.util.EnumSet +import io.sentry.android.gradle.extensions.InstrumentationFeature +import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel + +sentry { + tracingInstrumentation { + enabled.set(true) + + logcat { + enabled.set(true) + minLevel.set(LogcatLevel.WARNING) + } + } +} +``` diff --git a/platform-includes/logs/setup/android.timber.mdx b/platform-includes/logs/setup/android.timber.mdx new file mode 100644 index 0000000000000..7937d94a7dc1f --- /dev/null +++ b/platform-includes/logs/setup/android.timber.mdx @@ -0,0 +1,42 @@ +To enable logging, you need to initialize the SDK with the `logs.enabled` option set to `true`. + +```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 + } + } +} +``` + +```XML {filename:AndroidManifest.xml} + +``` + +You also need to install the Sentry Timber Integration, which is installed automatically when using the Sentry Android Gradle plugin. This integration captures log messages from the Timber library and sends them to Sentry. + +You may also set `minLogsLevel` in `SentryTimberIntegration` to configure which log messages are sent to Sentry. diff --git a/platform-includes/logs/usage/android.logcat.mdx b/platform-includes/logs/usage/android.logcat.mdx new file mode 100644 index 0000000000000..7a2577ed7d103 --- /dev/null +++ b/platform-includes/logs/usage/android.logcat.mdx @@ -0,0 +1 @@ +Once the plugin is configured with logging enabled, any logs at or above the `minLevel` will be sent to Sentry. This include any third party libraries that use the Android logcat. diff --git a/platform-includes/logs/usage/android.timber.mdx b/platform-includes/logs/usage/android.timber.mdx new file mode 100644 index 0000000000000..4f99ffd6389e6 --- /dev/null +++ b/platform-includes/logs/usage/android.timber.mdx @@ -0,0 +1 @@ +Once the integration is configured with logging enabled, any logs at or above the `minLogsLevel` will be sent to Sentry. From e1f83c557ad895b77b1a0b6f720ce4e079b69197 Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Tue, 8 Jul 2025 17:36:53 +0200 Subject: [PATCH 2/4] Logcat and Timber Logs integrations are now included in integrations pages directly --- .../android/integrations/logcat/index.mdx | 10 +++ .../android/integrations/timber/index.mdx | 10 +++ .../logs/integrations/android.logcat.mdx | 4 - .../logs/integrations/android.mdx | 4 +- .../logs/integrations/android.timber.mdx | 4 - .../logs/options/android.logcat.mdx | 47 ------------ .../logs/options/android.timber.mdx | 47 ------------ .../logs/requirements/android.logcat.mdx | 1 - .../logs/requirements/android.timber.mdx | 1 - .../logs/setup/android.logcat.mdx | 75 ------------------- .../logs/setup/android.timber.mdx | 42 ----------- .../logs/usage/android.logcat.mdx | 1 - .../logs/usage/android.timber.mdx | 1 - 13 files changed, 22 insertions(+), 225 deletions(-) delete mode 100644 platform-includes/logs/integrations/android.logcat.mdx delete mode 100644 platform-includes/logs/integrations/android.timber.mdx delete mode 100644 platform-includes/logs/options/android.logcat.mdx delete mode 100644 platform-includes/logs/options/android.timber.mdx delete mode 100644 platform-includes/logs/requirements/android.logcat.mdx delete mode 100644 platform-includes/logs/requirements/android.timber.mdx delete mode 100644 platform-includes/logs/setup/android.logcat.mdx delete mode 100644 platform-includes/logs/setup/android.timber.mdx delete mode 100644 platform-includes/logs/usage/android.logcat.mdx delete mode 100644 platform-includes/logs/usage/android.timber.mdx diff --git a/docs/platforms/android/integrations/logcat/index.mdx b/docs/platforms/android/integrations/logcat/index.mdx index 02d0706a2492d..9c89a41948ec7 100644 --- a/docs/platforms/android/integrations/logcat/index.mdx +++ b/docs/platforms/android/integrations/logcat/index.mdx @@ -119,3 +119,13 @@ Learn more about manually capturing an error or message in our To view and resolve the recorded message, log into [sentry.io](https://sentry.io) and open your project. Click on the error's title to open a page where you can see error details and mark errors as resolved. + +## Support With Sentry Logs + + + +Sentry Logs for Logcat are supported in Sentry Android SDK version `8.17.0` and above. + + + +Logcat logs at or above the `minLevel` captured by Sentry are automatically sent as Sentry Logs, if enabled. diff --git a/docs/platforms/android/integrations/timber/index.mdx b/docs/platforms/android/integrations/timber/index.mdx index e4205251fddc1..6db43b482946c 100644 --- a/docs/platforms/android/integrations/timber/index.mdx +++ b/docs/platforms/android/integrations/timber/index.mdx @@ -166,3 +166,13 @@ Learn more about manually capturing an error or message, in our To view and resolve the recorded message, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + +## Support With Sentry Logs + + + +Sentry Logs for Timber are supported in Sentry Android SDK version `8.17.0` and above. + + + +Timber logs at or above the `minLogsLevel` captured by Sentry are automatically sent as Sentry Logs, if enabled. diff --git a/platform-includes/logs/integrations/android.logcat.mdx b/platform-includes/logs/integrations/android.logcat.mdx deleted file mode 100644 index b82781c1a6ef1..0000000000000 --- a/platform-includes/logs/integrations/android.logcat.mdx +++ /dev/null @@ -1,4 +0,0 @@ -We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see. - -- [Timber](platforms/android/guides/timber/logs/) -- [Logcat](platforms/android/guides/logcat/logs/) diff --git a/platform-includes/logs/integrations/android.mdx b/platform-includes/logs/integrations/android.mdx index b82781c1a6ef1..0b63a4070eb2e 100644 --- a/platform-includes/logs/integrations/android.mdx +++ b/platform-includes/logs/integrations/android.mdx @@ -1,4 +1,4 @@ We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see. -- [Timber](platforms/android/guides/timber/logs/) -- [Logcat](platforms/android/guides/logcat/logs/) +- [Timber](/platforms/android/guides/timber/logs/) +- [Logcat](/platforms/android/guides/logcat/logs/) diff --git a/platform-includes/logs/integrations/android.timber.mdx b/platform-includes/logs/integrations/android.timber.mdx deleted file mode 100644 index b82781c1a6ef1..0000000000000 --- a/platform-includes/logs/integrations/android.timber.mdx +++ /dev/null @@ -1,4 +0,0 @@ -We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see. - -- [Timber](platforms/android/guides/timber/logs/) -- [Logcat](platforms/android/guides/logcat/logs/) diff --git a/platform-includes/logs/options/android.logcat.mdx b/platform-includes/logs/options/android.logcat.mdx deleted file mode 100644 index fe8b720ea5617..0000000000000 --- a/platform-includes/logs/options/android.logcat.mdx +++ /dev/null @@ -1,47 +0,0 @@ -#### beforeSendLog - -To filter logs, or update them before they are sent to Sentry, you can use the `getLogs().beforeSend` option. - -```java {tabTitle: Java} {10-14} -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().setBeforeSend((logEvent) -> { - // Modify the event here: - logEvent.setBody("new message body"); - return logEvent; - }); - }); - } -} -``` - -```kotlin {tabTitle: Kotlin} {11-15} -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.beforeSend = BeforeSendLogCallback { logEvent -> - // Modify the event here: - logEvent.body = "new message body" - return logEvent; - } - } - } -} -``` - - -The `beforeSend` function receives a log object, and should return the log object if you want it to be sent to Sentry, or `null` if you want to discard it. diff --git a/platform-includes/logs/options/android.timber.mdx b/platform-includes/logs/options/android.timber.mdx deleted file mode 100644 index fe8b720ea5617..0000000000000 --- a/platform-includes/logs/options/android.timber.mdx +++ /dev/null @@ -1,47 +0,0 @@ -#### beforeSendLog - -To filter logs, or update them before they are sent to Sentry, you can use the `getLogs().beforeSend` option. - -```java {tabTitle: Java} {10-14} -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().setBeforeSend((logEvent) -> { - // Modify the event here: - logEvent.setBody("new message body"); - return logEvent; - }); - }); - } -} -``` - -```kotlin {tabTitle: Kotlin} {11-15} -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.beforeSend = BeforeSendLogCallback { logEvent -> - // Modify the event here: - logEvent.body = "new message body" - return logEvent; - } - } - } -} -``` - - -The `beforeSend` function receives a log object, and should return the log object if you want it to be sent to Sentry, or `null` if you want to discard it. diff --git a/platform-includes/logs/requirements/android.logcat.mdx b/platform-includes/logs/requirements/android.logcat.mdx deleted file mode 100644 index d6428ba4579b8..0000000000000 --- a/platform-includes/logs/requirements/android.logcat.mdx +++ /dev/null @@ -1 +0,0 @@ -Logs for Logcat are supported in Sentry Android SDK version `8.17.0` and above. diff --git a/platform-includes/logs/requirements/android.timber.mdx b/platform-includes/logs/requirements/android.timber.mdx deleted file mode 100644 index 53a8117938a41..0000000000000 --- a/platform-includes/logs/requirements/android.timber.mdx +++ /dev/null @@ -1 +0,0 @@ -Logs for Timber are supported in Sentry Android SDK version `8.17.0` and above. diff --git a/platform-includes/logs/setup/android.logcat.mdx b/platform-includes/logs/setup/android.logcat.mdx deleted file mode 100644 index 17ce3264ca11c..0000000000000 --- a/platform-includes/logs/setup/android.logcat.mdx +++ /dev/null @@ -1,75 +0,0 @@ -To enable logging, you need to initialize the SDK with the `logs.enabled` option set to `true`. - -```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 - } - } -} -``` - -```XML {filename:AndroidManifest.xml} - -``` - -You also need to install the Sentry Logcat Integration using the Sentry Android Gradle plugin. This integration captures log messages from the Android logcat and sends them to Sentry. - -You may also set `minLevel` in `build.gradle` to configure which log messages are sent to Sentry. - -```groovy {filename:app/build.gradle} {10} -import io.sentry.android.gradle.extensions.InstrumentationFeature -import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel - -sentry { - tracingInstrumentation { - enabled = true - - logcat { - enabled = true - minLevel = LogcatLevel.WARNING - } - } -} -``` - -```kotlin {filename:app/build.gradle.kts} {11} -import java.util.EnumSet -import io.sentry.android.gradle.extensions.InstrumentationFeature -import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel - -sentry { - tracingInstrumentation { - enabled.set(true) - - logcat { - enabled.set(true) - minLevel.set(LogcatLevel.WARNING) - } - } -} -``` diff --git a/platform-includes/logs/setup/android.timber.mdx b/platform-includes/logs/setup/android.timber.mdx deleted file mode 100644 index 7937d94a7dc1f..0000000000000 --- a/platform-includes/logs/setup/android.timber.mdx +++ /dev/null @@ -1,42 +0,0 @@ -To enable logging, you need to initialize the SDK with the `logs.enabled` option set to `true`. - -```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 - } - } -} -``` - -```XML {filename:AndroidManifest.xml} - -``` - -You also need to install the Sentry Timber Integration, which is installed automatically when using the Sentry Android Gradle plugin. This integration captures log messages from the Timber library and sends them to Sentry. - -You may also set `minLogsLevel` in `SentryTimberIntegration` to configure which log messages are sent to Sentry. diff --git a/platform-includes/logs/usage/android.logcat.mdx b/platform-includes/logs/usage/android.logcat.mdx deleted file mode 100644 index 7a2577ed7d103..0000000000000 --- a/platform-includes/logs/usage/android.logcat.mdx +++ /dev/null @@ -1 +0,0 @@ -Once the plugin is configured with logging enabled, any logs at or above the `minLevel` will be sent to Sentry. This include any third party libraries that use the Android logcat. diff --git a/platform-includes/logs/usage/android.timber.mdx b/platform-includes/logs/usage/android.timber.mdx deleted file mode 100644 index 4f99ffd6389e6..0000000000000 --- a/platform-includes/logs/usage/android.timber.mdx +++ /dev/null @@ -1 +0,0 @@ -Once the integration is configured with logging enabled, any logs at or above the `minLogsLevel` will be sent to Sentry. From c207fb63e4f7bab9c921966e37cab3977ef8cdca Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Tue, 8 Jul 2025 17:37:25 +0200 Subject: [PATCH 3/4] Logcat and Timber Logs integrations are now included in integrations pages directly --- platform-includes/logs/integrations/android.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform-includes/logs/integrations/android.mdx b/platform-includes/logs/integrations/android.mdx index 0b63a4070eb2e..21ce28f10b246 100644 --- a/platform-includes/logs/integrations/android.mdx +++ b/platform-includes/logs/integrations/android.mdx @@ -1,4 +1,4 @@ We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see. -- [Timber](/platforms/android/guides/timber/logs/) -- [Logcat](/platforms/android/guides/logcat/logs/) +- [Timber](/platforms/integrations/timber/) +- [Logcat](/platforms/integrations/logcat/) From 479bce30aa8d8e4c9f3391f10797dcc3c89ac6b6 Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Tue, 8 Jul 2025 22:10:02 +0200 Subject: [PATCH 4/4] fixed links --- platform-includes/logs/integrations/android.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform-includes/logs/integrations/android.mdx b/platform-includes/logs/integrations/android.mdx index 21ce28f10b246..27e50ccad9663 100644 --- a/platform-includes/logs/integrations/android.mdx +++ b/platform-includes/logs/integrations/android.mdx @@ -1,4 +1,4 @@ We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-java/issues/new/choose) for any integration you would like to see. -- [Timber](/platforms/integrations/timber/) -- [Logcat](/platforms/integrations/logcat/) +- [Timber](/platforms/android/integrations/timber/) +- [Logcat](/platforms/android/integrations/logcat/)