Skip to content

ref(logging): [Logs and Metrics Enable Flags 14] Rename Logs opt-ins - #5970

Draft
adinauer wants to merge 20 commits into
fix/timber-lazy-logs-optionfrom
ref/logs-enabled-naming
Draft

adinauer wants to merge 20 commits into
fix/timber-lazy-logs-optionfrom
ref/logs-enabled-naming

Conversation

@adinauer

@adinauer adinauer commented Aug 14, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Logs and Metrics Enable Flags)


📜 Description

Renames the generic logging-integration opt-in from enableLogs to logsEnabled before the new API is released:

  • Logback XML: <logsEnabled>true</logsEnabled>
  • Log4j2 plugin attribute: logsEnabled="true"
  • JUL LogManager: io.sentry.jul.SentryHandler.logsEnabled=true
  • Spring Boot: sentry.logging.logs-enabled=true
  • Timber constructors and property: logsEnabled
  • Android Timber option: timberLogCaptureEnabled
  • Android Logcat option: logcatLogCaptureEnabled

Java integrations expose state-oriented get...Enabled() and set...Enabled() accessors, which map to natural .logsEnabled, .timberLogCaptureEnabled, and .logcatLogCaptureEnabled property syntax in Kotlin. Samples, tests, API dumps, and option guidance use the renamed controls.

The Android manifest keys remain io.sentry.timber.logs.enabled and io.sentry.logcat.logs.enabled.

The existing preferred Log4j2 constructor and factory, plus the Timber primary constructors, now accept the opt-in directly instead of publishing compatibility overloads. These intentional v9 JVM signature changes are documented under Breaking Changes in the changelog.

💡 Motivation and Context

logsEnabled describes state rather than an action and provides a consistent .logsEnabled property across Kotlin-native and Java-defined integrations. The Android source-specific names use logCaptureEnabled to make clear that the SDK captures from Timber and Logcat rather than outputting to them.

💚 How did you test it?

  • ./gradlew :sentry-logback:test :sentry-log4j2:test :sentry-jul:test :sentry-android-timber:testReleaseUnitTest :sentry-android-core:testReleaseUnitTest :sentry-spring-boot:test :sentry-spring-boot-jakarta:test :sentry-spring-boot-4:test
  • ./gradlew spotlessApply apiDump

📝 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.

#skip-changelog

⚠️ 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 13, 2026 15:21
Initialize the fatal logger before external configuration is merged and route legacy Logs and Metrics migration warnings through the always-visible startup logger across core, Android, and Spring Boot.

Co-Authored-By: Claude <noreply@anthropic.com>
Use state-oriented names for the new Logback, Log4j2, JUL, Timber, Logcat, and Spring Boot Logs controls. Expose get...Enabled accessors so Java-defined options map to natural Kotlin properties before these APIs are released.

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

sentry Bot commented Aug 14, 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

This was referenced Aug 14, 2026

@runningcode runningcode left a comment

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.

Yes! Much better API

# Conflicts:
#	sentry-android-core/api/sentry-android-core.api
#	sentry-logback/api/sentry-logback.api
# Conflicts:
#	sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java
#	sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt
#	sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java
#	sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt
#	sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java
#	sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt
#	sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java
#	sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt
#	sentry/src/main/java/io/sentry/SentryOptions.java
#	sentry/src/test/java/io/sentry/SentryOptionsTest.kt
# Conflicts:
#	sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java
#	sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt
#	sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt
#	sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt
#	sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt
@adinauer
adinauer changed the base branch from fix/visible-enable-flag-warnings to fix/timber-lazy-logs-option September 30, 2026 08:53
@adinauer adinauer changed the title ref(logging): [Logs and Metrics Enable Flags 21] Rename Logs opt-ins ref(logging): [Logs and Metrics Enable Flags 14] Rename Logs opt-ins Sep 30, 2026
adinauer and others added 12 commits September 30, 2026 12:45
Update the remaining fixture call to use logsEnabled so the renamed API compiles.

Co-Authored-By: Claude <noreply@anthropic.com>
Keep the newly added Log4j2 auto-configuration wiring aligned with the logsEnabled accessor and Spring property introduced by this branch.

Co-Authored-By: Claude <noreply@anthropic.com>
Keep the null-message resource-bundle regression test aligned with the logsEnabled fixture option introduced by this branch.

Co-Authored-By: Claude <noreply@anthropic.com>
Rename the Timber and Logcat options to make it explicit that they
control capture into Sentry rather than output to those logging systems.
Keep natural property syntax for Kotlin callers and align tests and
guidance with the new names.

Co-Authored-By: Claude <noreply@anthropic.com>
Add the Logs opt-in directly to the existing Log4j2 and Timber
constructor signatures instead of retaining compatibility overloads.
Document the intentional v9 API changes in the changelog.

BREAKING CHANGE: Log4j2 and Timber callers using explicit constructor
signatures must pass the new Logs opt-in argument.

Co-Authored-By: Claude <noreply@anthropic.com>
Merge the latest Timber lazy-option fixes from PR #5964 into the stack
tip. Preserve the renamed capture options and revised constructor API
while retaining the internal lazy constructor and lambda wiring.

Co-Authored-By: Claude <noreply@anthropic.com>
Keep structured Logs enabled in the Spring Boot Log4j2 samples after removing the aggregate Logs configuration.

Co-Authored-By: Claude <noreply@anthropic.com>
Classify removal of the aggregate options as breaking changes and list the source-specific opt-ins for automatic Logs capture.

Co-Authored-By: Claude <noreply@anthropic.com>
Replace the no-argument SentryTimberIntegration constructor with a
boolean overload so manually installed integrations must choose whether
to forward Sentry Logs.

Keep the lazy evaluator path for auto-installed integrations and clarify
the separate Android option and constructor configuration paths.

BREAKING CHANGE: SentryTimberIntegration() now requires a logsEnabled argument.
Co-Authored-By: Claude <noreply@anthropic.com>

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.

2 participants