Skip to content

fix(jul): [Logs and Metrics Enable Flags 17] Preserve null-message records - #5960

Open
adinauer wants to merge 4 commits into
perf/metrics-batch-thread-first-usefrom
fix/jul-null-log-message
Open

fix(jul): [Logs and Metrics Enable Flags 17] Preserve null-message records#5960
adinauer wants to merge 4 commits into
perf/metrics-batch-thread-first-usefrom
fix/jul-null-log-message

Conversation

@adinauer

@adinauer adinauer commented Aug 13, 2026

Copy link
Copy Markdown
Member

PR Stack (Logs and Metrics Enable Flags)


📜 Description

Skips Sentry Logs conversion when a valid JUL LogRecord has a null message. Event and breadcrumb processing continues normally, while no invalid Sentry Log item is created.

💡 Motivation and Context

JUL permits null messages. When Sentry Logs forwarding was enabled, captureLog dereferenced the null formatted message before the established event and breadcrumb branches ran. The enclosing error handler then aborted processing, dropping an otherwise valid event or breadcrumb.

The issue is specific to JUL's nullable LogRecord path. Logcat and Timber already handle nullable bodies explicitly, Logback does not dereference its nullable formatted message in this path, and standard Log4j2 message implementations provide a formatted string.

💚 How did you test it?

  • ./gradlew :sentry-jul:test
  • ./gradlew spotlessApply apiDump
  • Added a regression test proving null-message JUL records still produce an event and breadcrumb with Logs enabled, but no Sentry Log item

📝 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

None.

#skip-changelog

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

Skip only Sentry Logs conversion when a valid JUL record has no message, allowing its event and breadcrumb capture paths to continue.

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

final @NotNull String formattedMessage = maybeFormatted(arguments, message);

if (!formattedMessage.equals(message)) {

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.

This would be causing a NullPointerException. This PR fixes that.

@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

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 526.81 ms 599.36 ms 72.55 ms
Size 0 B 0 B 0 B

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