Skip to content

feat(android): [Logs and Metrics Enable Flags 4] Add Timber Logs opt-in - #5943

Open
adinauer wants to merge 3 commits into
feat/logs-opt-in-julfrom
feat/logs-opt-in-timber
Open

adinauer wants to merge 3 commits into
feat/logs-opt-in-julfrom
feat/logs-opt-in-timber

Conversation

@adinauer

@adinauer adinauer commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Logs and Metrics Enable Flags)


📜 Description

Adds a logsEnabled option to SentryTimberIntegration and SentryTimberTree, defaulting to false while preserving their existing JVM constructor signatures.

Adds SentryAndroidOptions.timberLogsEnabled and the io.sentry.timber.logs.enabled manifest key for auto-installed Timber integrations. Manually installed integrations and trees can opt in through their new constructor arguments.

Timber forwarding requires both this local opt-in and the existing aggregate core Logs flag until that flag is removed later in the stack. Event and breadcrumb capture remain unchanged.

💡 Motivation and Context

Logging integrations need explicit local opt-ins before the aggregate core Logs flag can be removed. This keeps automatic Timber log forwarding disabled by default while allowing applications to opt in through Java, Kotlin, or Android manifest configuration.

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • ./gradlew :sentry-android-timber:testReleaseUnitTest :sentry-android-core:testReleaseUnitTest
  • Added tests for default-disabled and explicit opt-in behavior for auto-installed and manual Timber integrations and trees
  • Added regression coverage for independent event and breadcrumb capture

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Add the Logcat Logs opt-in before removing the aggregate core Logs flag.

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into 9.x.x.

adinauer and others added 2 commits August 12, 2026 16:18
Require an explicit Timber-local opt-in before forwarding Timber messages as Sentry Logs. Add Android options and manifest configuration for auto-installed integrations while preserving event and breadcrumb capture.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against f0d4297

@sentry

sentry Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.58.0 (1) release

⚙️ sentry-android Build Distribution Settings

@adinauer
adinauer marked this pull request as ready for review August 13, 2026 13:40

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4f677fb. Configure here.

this.enableNetworkEventBreadcrumbs = enableNetworkEventBreadcrumbs;
}

public boolean isEnableTimberLogs() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about naming this TimberLogCapture?

IMO, the current API isn't clear if we are outputting to Timber or capturing from Timber.

Suggested change
public boolean isEnableTimberLogs() {
public boolean setTimberLogCaptureEnabled() {

minEventLevel: SentryLevel = SentryLevel.ERROR,
minBreadcrumbLevel: SentryLevel = SentryLevel.INFO,
minLogsLevel: SentryLogLevel = SentryLogLevel.INFO,
enableLogs: Boolean? = true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(l) we could default to enableLogs: Boolean? = null so all old tests use the old ctor. And only the specific logging tests could set true/false.

# Conflicts:
#	sentry-android-core/api/sentry-android-core.api

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants