Product Benefits Pricing Guides Docs About Contact us Try it out
Analytics tools

Sentry Java Direct Logs and Metrics Tracking

Sentry Java 8.59.0 captures direct logger and metrics calls even when options are off. Track log and metric volume so the change does not surprise you.

· 3 min read

Teams often leave an observability feature switched off in config and assume nothing is sent. Then a library upgrade changes the rule, and data starts flowing that nobody planned for. The first sign is usually a bigger bill or a privacy question from legal.

Sentry Java 8.59.0, released on 4 November 2026, includes a breaking change of exactly this kind. Direct calls to Sentry.logger() and Sentry.metrics() are now captured whatever the logs and metrics enable options say. The release also deprecates sendDefaultPii in favour of dataCollection, which is covered in our PII post.

If your code already calls these APIs while the options are off, you may have been silently dropping data. After the upgrade, that data is sent. That could be useful or unwelcome, so measure it.

Data Points to Track

  • log_events_per_session before and after the upgrade
  • metric_events_per_session before and after the upgrade
  • log_level distribution (debug, info, warn, error)
  • logs_option_enabled and metrics_option_enabled as configured
  • direct_call_sites, the number of Sentry.logger() and Sentry.metrics() calls in the code
  • sentry_java_version and app_version
  • payload_bytes_per_session for logs and metrics
  • sensitive_attribute_hits, any log or metric attribute that matches a personal data rule

Setup Steps

  1. Search your codebase for Sentry.logger() and Sentry.metrics() calls and list each one.
  2. Record the current options for logs and metrics in every build variant.
  3. Decide the intent. For each call site, choose whether it should send data. If not, remove the call or guard it.
  4. Upgrade to 8.59.0 or later in a staging build and watch volume for a day.
  5. Compare payload size and event counts with the previous version.
  6. Scrub attributes that could hold names, emails or identifiers before they leave the device.
  7. Set a volume alert so a sudden jump in logs or metrics is flagged within hours.

Actionable Insights

A sharp rise in log volume after the upgrade tells you the old option was hiding calls. Review those call sites one by one. Some are valuable and should stay. Others are leftover debug lines that should go.

Look at the level mix. If most events are debug, filter them in production and keep warn and error. Smaller streams are cheaper and easier to read.

Check attributes carefully. Developers often log a user id or an email to help debugging. When logs become visible to a wider team, that habit becomes a privacy risk. Treat any hit on your sensitive attribute check as a bug to fix before release.

Finally, connect volume to cost. If metrics add little decision value, remove them. Data nobody reads is only a liability.

Common Mistakes to Avoid

Do not assume an option set to false blocks every path. Test the real behaviour after each major SDK change, and read the breaking-change section of release notes before you merge a dependency bump.

Do not roll out to all users at once. A staged rollout gives you a chance to catch noisy call sites while the audience is small.