Skip to content

Support logging via native APIs on Android #5911

Description

@triplef

Problem Statement

We would like to use the native sentry_log_*() / sentry_log() APIs in our Android app.

While we can enable logs via SentryAndroidOptions (logs.enabled / io.sentry.logs.enabled manifest key), when the native SDK is initialized through the NDK integration this flag is not passed on:

  • SentryNdk.init() builds the native options from NdkOptions, which only carries DSN, debug, outbox path, release, environment, dist, max breadcrumbs, and SDK name (plus handler strategy, traces sample rate, and app-hang settings) — see SentryNdk.java
  • NdkOptions has no logs-related field — see NdkOptions.java
  • sentry-native options are immutable after sentry_init(), which the NDK integration performs — so the app cannot set enable_logs itself afterward.

As a result, enable_logs is always false in the native SDK on Android, and every call to sentry_log_*() / sentry_log() from native code returns SENTRY_LOG_RETURN_DISABLED and is silently dropped — even when the user has explicitly enabled logs in their Android SDK configuration.

Solution Brainstorm

  • Forward options.getLogs().isEnabled() in SentryNdk.init() in sentry-java.
  • Add an enableLogs field to NdkOptions and apply it in the NDK init path via sentry_options_set_enable_logs().
  • Possibly also forward logs_with_attributes and consider routing beforeSendLog semantics, though the enable_logs flag alone would unblock the feature.

Native logs are sent through the outbox/envelope path, so ingestion should work with the existing transport once the option is enabled.

Activity

  1. linear-code commented on Aug 7, 2026

    @linear-code
  2. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Aug 7, 2026
  3. romtsn commented on Aug 10, 2026

    @romtsn
    Member

    hi @triplef this is a reasonable FR -- I've opened #5923 and getsentry/sentry-native#1971 to address it, should likely land in the next release!

  4. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Aug 10, 2026
  5. triplef commented on Aug 10, 2026

    @triplef
    Author

    Awesome, thank you @romtsn!

  6. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Aug 10, 2026
  7. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Aug 13, 2026
  8. triplef commented on Sep 10, 2026

    @triplef
    Author

    Thanks — this works now in the latest releases. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions