Skip to content

feat(logback): [Logs and Metrics Enable Flags 1] Add Logs opt-in - #5940

Open
adinauer wants to merge 2 commits into
feat/logs-metrics-enable-flagsfrom
feat/logs-opt-in-logback
Open

feat(logback): [Logs and Metrics Enable Flags 1] Add Logs opt-in#5940
adinauer wants to merge 2 commits into
feat/logs-metrics-enable-flagsfrom
feat/logs-opt-in-logback

Conversation

@adinauer

@adinauer adinauer commented Aug 12, 2026

Copy link
Copy Markdown
Member

PR Stack (Logs and Metrics Enable Flags)


📜 Description

Adds an enableLogs option to the Logback SentryAppender. The option defaults to false and can be configured through Java or Logback XML.

The appender now requires both this local opt-in and the existing aggregate core Logs flag before forwarding Logback records as Sentry Logs. 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. This prevents applications from unexpectedly forwarding framework logs when core Logs capture becomes available without a global enable flag.

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • ./gradlew :sentry-logback:test
  • Added tests for the default-disabled behavior, explicit opt-in, 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 15:52
Require an explicit Logback appender opt-in before forwarding records as Sentry Logs. Keep event and breadcrumb capture independent while the aggregate core Logs flag remains in place.

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 7419f01

@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

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

I put a global suggestion on the naming, probably worth a discussion with the team but otherwise going to approve

public fun getMinimumBreadcrumbLevel ()Lch/qos/logback/classic/Level;
public fun getMinimumEventLevel ()Lch/qos/logback/classic/Level;
public fun getMinimumLevel ()Lch/qos/logback/classic/Level;
public fun isEnableLogs ()Z

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.

would it be more idiomatic to make this logsEnabled()?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Afaik other SDKs are calling the option enableLogs too, so I wanted to align.

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.

good point, this is the classic tension of consistency vs feeling native to the platform. Given our new goal hierarchy, I would think it should be the one that feels native.

public fun getMinimumEventLevel ()Lch/qos/logback/classic/Level;
public fun getMinimumLevel ()Lch/qos/logback/classic/Level;
public fun isEnableLogs ()Z
public fun setEnableLogs (Z)V

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.

same suggestion as above

Suggested change
public fun setEnableLogs (Z)V
public fun setLogsEnabled (Z)V

private @NotNull Level minimumBreadcrumbLevel = Level.INFO;
private @NotNull Level minimumEventLevel = Level.ERROR;
private @NotNull Level minimumLevel = Level.INFO;
private boolean enableLogs = false;

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.

Suggested change
private boolean enableLogs = false;
private boolean logsEnabled = false;

@adinauer
adinauer marked this pull request as ready for review August 13, 2026 13:40
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