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.
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.enabledmanifest key), when the native SDK is initialized through the NDK integration this flag is not passed on:SentryNdk.init()builds the native options fromNdkOptions, 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.javaNdkOptionshas no logs-related field — see NdkOptions.javasentry_init(), which the NDK integration performs — so the app cannot setenable_logsitself afterward.As a result,
enable_logsis always false in the native SDK on Android, and every call tosentry_log_*()/sentry_log()from native code returnsSENTRY_LOG_RETURN_DISABLEDand is silently dropped — even when the user has explicitly enabled logs in their Android SDK configuration.Solution Brainstorm
options.getLogs().isEnabled()inSentryNdk.init()in sentry-java.enableLogsfield toNdkOptionsand apply it in the NDK init path viasentry_options_set_enable_logs().logs_with_attributesand consider routingbeforeSendLogsemantics, though theenable_logsflag 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.