Skip to content

feat(core): [Logs and Metrics Enable Flags 7] Remove Logs enable flag - #5947

Open
adinauer wants to merge 3 commits into
feat/logs-opt-in-spring-bootfrom
feat/remove-logs-enable-flag
Open

feat(core): [Logs and Metrics Enable Flags 7] Remove Logs enable flag#5947
adinauer wants to merge 3 commits into
feat/logs-opt-in-spring-bootfrom
feat/remove-logs-enable-flag

Conversation

@adinauer

@adinauer adinauer commented Aug 12, 2026

Copy link
Copy Markdown
Member

PR Stack (Logs and Metrics Enable Flags)


📜 Description

Removes SentryOptions.Logs.isEnabled and setEnabled and the aggregate Logs gate from LoggerApi. Manual Sentry.logger() calls now capture Logs whenever the SDK is enabled.

SentryClient now always creates the configured logger batch processor. Logback, Log4j2, JUL, Timber, and Logcat continue to require their integration-local opt-ins introduced earlier in this stack.

Stops applying the legacy external and Android manifest values while retaining their parsing/accessors and metadata key for migration warnings in the following PRs. Removes active legacy Logs configuration from samples and test fixtures.

💡 Motivation and Context

The aggregate Logs flag duplicates integration-local controls and makes manual structured logging require an unnecessary global opt-in. Removing it gives Sentry.logger() the same direct capture semantics as other SDK APIs while local integration flags prevent unexpected automatic log forwarding.

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • ./gradlew :sentry:test :sentry-android-core:testReleaseUnitTest
  • ./gradlew :sentry-logback:test :sentry-log4j2:test :sentry-jul:test :sentry-android-timber:testReleaseUnitTest
  • ./gradlew :sentry-spring-boot:test :sentry-spring-boot-jakarta:test :sentry-spring-boot-4:test
  • Updated core and integration tests to verify capture without the aggregate option and continued local gating

📝 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 targeted warnings for legacy Android manifest, external, and Spring Boot Logs configuration.

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

adinauer and others added 2 commits August 12, 2026 16:43
Capture manual Sentry Logs without an aggregate enable option and always create the configured logger batch processor. Keep automatic logging integrations controlled by their local opt-ins and remove legacy Logs configuration from active samples and fixtures.

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 b9d76ce

@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.52.0 (1) release

⚙️ sentry-android Build Distribution Settings

Keep the integration-local enableLogs setting while removing the aggregate Logs configuration that no longer exists.

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

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 318.02 ms 383.41 ms 65.39 ms
Size 0 B 0 B 0 B

Comment on lines 3733 to 3738
}
}

if (options.isEnableLogs() != null) {
getLogs().setEnabled(options.isEnableLogs());
}

if (options.isEnableMetrics() != null) {
getMetrics().setEnabled(options.isEnableMetrics());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The logs.enabled configuration is now parsed but silently ignored, causing logs to be captured even when users have explicitly disabled them.
Severity: MEDIUM

Suggested Fix

To prevent this silent breaking change, either restore the functionality of the logs.enabled flag or add a prominent warning when this deprecated configuration is detected. This will inform users about the change in behavior and guide them on how to properly configure logging going forward, preventing unexpected data capture.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: sentry/src/main/java/io/sentry/SentryOptions.java#L3733-L3738

Potential issue: The `logs.enabled` configuration property is now parsed but silently
ignored. The pull request removes the `enable` field from `SentryOptions.Logs` and the
corresponding `options.getLogs().isEnabled()` checks in `SentryClient` and
`LoggerApi.captureLog()`. As a result, users who have explicitly set
`logs.enabled=false` in their configuration to disable logging will find that logs are
now captured and sent as long as the SDK itself is enabled. This silent breaking change
goes against explicit user configuration and can lead to unexpected data collection and
network usage.

Also affects:

  • sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java:706~711

Did we get this right? 👍 / 👎 to inform future reviews.

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.

1 participant