Skip to content

feat(core): [Logs and Metrics Enable Flags 9] Warn for legacy Logs configuration - #5950

Open
adinauer wants to merge 2 commits into
feat/warn-legacy-logs-manifestfrom
feat/warn-legacy-logs-external
Open

feat(core): [Logs and Metrics Enable Flags 9] Warn for legacy Logs configuration#5950
adinauer wants to merge 2 commits into
feat/warn-legacy-logs-manifestfrom
feat/warn-legacy-logs-external

Conversation

@adinauer

@adinauer adinauer commented Aug 13, 2026

Copy link
Copy Markdown
Member

PR Stack (Logs and Metrics Enable Flags)


📜 Description

Keeps parsing the nullable legacy logs.enabled external option and emits a tailored migration warning from SentryOptions.merge for explicit true and false values.

The legacy value no longer changes SDK behavior. Manual Sentry.logger() capture remains active for either value, while absent configuration emits no warning.

💡 Motivation and Context

The aggregate Logs enable flag was removed earlier in this stack. Existing sentry.properties, environment-variable, and system-property configurations need a clear migration diagnostic rather than being silently ignored.

💚 How did you test it?

  • ./gradlew :sentry:test
  • ./gradlew spotlessApply apiDump
  • Added external parsing tests for absent, true, and false values
  • Added merge tests for tailored warnings and unchanged manual Logs 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 equivalent migration warning for legacy Spring Boot Logs configuration.

#skip-changelog

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

Keep parsing the nullable logs.enabled external option and emit tailored migration warnings for explicit true and false values without changing manual Logs capture.

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

github-actions Bot commented Aug 13, 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 8a414c2

@sentry

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

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 317.73 ms 376.65 ms 58.92 ms
Size 0 B 0 B 0 B

Previous results on branch: feat/warn-legacy-logs-external

Startup times

Revision Plain With Sentry Diff
623c4e5 312.67 ms 343.90 ms 31.23 ms

App size

Revision Plain With Sentry Diff
623c4e5 0 B 0 B 0 B

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

Reviewed by Cursor Bugbot for commit 8a414c2. Configure here.

"The 'logs.enabled' option no longer disables manual Sentry.logger() calls. Automatic "
+ "logging integrations remain disabled unless enabled through their own opt-ins.");
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Legacy logs warning never surfaces

Medium Severity

The migration warning for legacy logs.enabled is written through SentryOptions.logger inside merge. External configuration is merged in preInitConfigurations while that logger is still NoOpLogger; initLogger runs only afterward. Users with sentry.properties, env vars, or system properties therefore get no diagnostic, so logs.enabled=false is ignored without notice.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8a414c2. Configure here.

Comment on lines +3747 to +3749
+ "logging integrations remain disabled unless enabled through their own opt-ins.");
}
}

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 migration warning for the deprecated logs.enabled configuration will not be displayed by default because it is logged via DiagnosticLogger, which requires debug mode to be enabled.
Severity: MEDIUM

Suggested Fix

The warning should be logged using a mechanism that is not dependent on the debug flag. Consider using a different logger or logging at a level that bypasses the debug check to ensure the migration warning is always visible to users with the deprecated configuration.

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#L3747-L3749

Potential issue: The migration warning for the deprecated `logs.enabled` configuration
is logged using a `DiagnosticLogger`. This logger's `log()` method is gated by
`options.isDebug()`, which defaults to `false`. As a result, users with the legacy
configuration will not see the intended migration diagnostic warning unless they have
explicitly enabled debug mode. This undermines the feature's goal of providing clear
migration guidance, as the warning will be silently suppressed for most users in
production environments.

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.

2 participants