Skip to content

feat(log4j2): [Logs and Metrics Enable Flags 2] Add Logs opt-in - #5941

Draft
adinauer wants to merge 2 commits into
feat/logs-opt-in-logbackfrom
feat/logs-opt-in-log4j2
Draft

feat(log4j2): [Logs and Metrics Enable Flags 2] Add Logs opt-in#5941
adinauer wants to merge 2 commits into
feat/logs-opt-in-logbackfrom
feat/logs-opt-in-log4j2

Conversation

@adinauer

@adinauer adinauer commented Aug 12, 2026

Copy link
Copy Markdown
Member

PR Stack (Logs and Metrics Enable Flags)


📜 Description

Adds an enableLogs plugin attribute to the Log4j2 SentryAppender. The option defaults to false and requires the existing aggregate core Logs flag while that flag remains in place.

Existing public constructors and the existing createAppender factory signature remain available and delegate with Logs disabled. New overloads accept the local opt-in. 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 later in this stack. Preserving existing entry points avoids an unrelated compatibility break while changing their default Logs behavior safely.

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • ./gradlew :sentry-log4j2:test
  • Added tests for plugin defaults and opt-in, preserved entry points, and independent event/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

Continue adding integration-local Logs opt-ins before removing the aggregate core Logs flag.

⚠️ 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:01
Require an explicit Log4j2 appender opt-in before forwarding records as Sentry Logs. Preserve existing constructors and factory methods with Logs disabled by default while keeping events and breadcrumbs unchanged.

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

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 11568c0

@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

This was referenced Aug 12, 2026
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