Skip to content

feat(android): Forward logs.enabled to sentry-native - #5923

Draft
romtsn wants to merge 1 commit into
mainfrom
roman/forward-enable-logs-ndk
Draft

feat(android): Forward logs.enabled to sentry-native#5923
romtsn wants to merge 1 commit into
mainfrom
roman/forward-enable-logs-ndk

Conversation

@romtsn

@romtsn romtsn commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Forwards SentryOptions.Logs.isEnabled() to NdkOptions.setEnableLogs() during NDK init
  • Unblocks sentry_log_*() / sentry_log() calls from native code on Android

Depends on getsentry/sentry-native#1971 — needs a sentry-native-ndk release with the new NdkOptions.enableLogs field before this can merge.

Fixes #5911

Test plan

  • Bump sentry-native-ndk version once the dependency PR is released
  • Verify native logs reach Sentry when logs.enabled = true
  • Verify native logs are dropped when logs.enabled = false (default)

🤖 Generated with Claude Code

Pass `SentryOptions.Logs.isEnabled()` through to `NdkOptions` so
native `sentry_log_*()` calls work when the user enables logs.

Depends on getsentry/sentry-native#1971 (sentry-native-ndk release
with `NdkOptions.setEnableLogs`).

Fixes #5911

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor
Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Features

- Forward logs.enabled to sentry-native ([#5923](https://github.com/getsentry/sentry-java/pull/5923))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against 12095ce

ndkOptions.setEnableAppHangTracking(options.isEnableNdkAppHangTracking());
ndkOptions.setAppHangTimeoutMillis(options.getNdkAppHangTimeoutIntervalMillis());

ndkOptions.setEnableLogs(options.getLogs().isEnabled());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The call to ndkOptions.setEnableLogs() will cause a NoSuchMethodError at runtime, as the method does not exist in the current sentry-native-ndk dependency version.
Severity: CRITICAL

Suggested Fix

This pull request should not be merged until the sentry-native-ndk dependency containing the NdkOptions.enableLogs field is released. After the dependency is released, update its version in gradle/libs.versions.toml before merging.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: sentry-android-ndk/src/main/java/io/sentry/android/ndk/SentryNdk.java#L79

Potential issue: The code unconditionally calls `ndkOptions.setEnableLogs()`, a method
that is part of the `sentry-native-ndk` dependency. According to the pull request
description, this feature is not yet available in the currently specified dependency
version (`0.16.2`). This will result in a `NoSuchMethodError` at runtime when
`SentryNdk.init()` is invoked. The error will cause a complete NDK initialization
failure, crashing any Android application that uses the Sentry SDK with NDK integration
during its startup sequence.

Did we get this right? 👍 / 👎 to inform future reviews.

@romtsn
romtsn marked this pull request as draft August 10, 2026 12:28
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.

Support logging via native APIs on Android

1 participant