Skip to content

fix(core): Reduce serialization log spam - #6255

Draft
adinauer wants to merge 2 commits into
9.x.xfrom
feat/disable-serializer-logging-v9
Draft

adinauer wants to merge 2 commits into
9.x.xfrom
feat/disable-serializer-logging-v9

Conversation

@adinauer

Copy link
Copy Markdown
Member

📜 Description

Add an ISerializer.serialize overload that accepts an enableLogging flag. The default implementation delegates to the existing overload to preserve compatibility with custom serializers, while JsonSerializer honors the flag.

Use the new overload from JsonSerializationUtils.byteSizeOf with logging disabled so byte-size calculations do not emit duplicate Serializing object debug messages.

💡 Motivation and Context

Calculating serialized byte sizes currently causes full objects, including log envelopes, to be written to debug logs. This produces significant log spam even though serialization is only being performed for accounting or size checks.

Resolves #4946
Refs JAVA-261

💚 How did you test it?

  • ./gradlew :sentry:test --tests io.sentry.JsonSerializerTest --tests io.sentry.util.JsonSerializationUtilsTest
  • ./gradlew :sentry:apiCheck
  • ./gradlew spotlessApply apiDump

📝 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.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

None.

Allow serializers to suppress debug logging for individual calls and disable it while calculating serialized byte sizes. Preserve compatibility for custom serializers through a default interface implementation.

Fixes #4946

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

linear-code Bot commented Oct 14, 2026

Copy link
Copy Markdown

JAVA-261

@sentry

sentry Bot commented Oct 14, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.59.0 (1) release

⚙️ sentry-android Build Distribution Settings

This branch has not been deployed

No deployments
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