FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(logback): [Logs and Metrics Enable Flags 1] Add Logs opt-in by adinauer · Pull Request #5940 · getsentry/sentry-java · GitHub

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 commented Aug 12, 2026
edited
Loading

Copy link
Copy Markdown
Member

PR Stack (Logs and Metrics Enable Flags)


📜 Description

Adds a logsEnabled 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>

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Discussed in slack, we should make this feel native.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Adding my 2 cents here: I do believe the getter should still follow JavaBean conventions and be isLogsEnabled().

My reasoning here:

  • Getters through the whole SDK use this convention
  • Frameworks like Spring (Boot) may rely on this convention as well

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
private boolean enableLogs = false;
private boolean logsEnabled = false;

adinauer marked this pull request as ready for review August 13, 2026 13:40

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

After a discussion, I think we should make this feel native!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL