Skip to content

moq-tokio: Rust logs never reach logcat on Android because no build enables android-logcat #4456

Description

@pwrwpw

Problem

moq_tokio::Log::init routes logs to logcat only when the android-logcat feature is enabled, and to stderr otherwise. Android app processes discard stderr, so without the feature every Rust log is lost.

No shipped build enables the feature (at a0929c90b):

  • rs/moq-tokio/src/log.rs:69: the logcat layer is gated on all(target_os = "android", feature = "android-logcat").
  • rs/libmoq/Cargo.toml: there is no [features] section, so a C API consumer cannot enable it.
  • rs/moq-ffi/Cargo.toml:29: android-logcat is declared but not in default, and rs/moq-ffi/build.sh:133 builds Android targets without it. release-kt-ffi.yml and release-dart-ffi.yml call that script, so the published Kotlin and Dart bindings log to stderr on Android too.

Measured behavior

On an Android device, with libmoq built with the gate removed and no extra features, moq_log_level("info") sends logs to logcat:

W MoQNative: moq_tokio::tls: TLS server certificate verification is disabled; ...
I MoQNative: moq_tokio::client: connected version=moq-lite-05

Possible approaches

  1. Always use logcat on Android. Gate the layer on target_os = "android" alone, make tracing-android a regular Android-only dependency, and remove the android-logcat feature from moq-tokio and moq-ffi. Other targets are unaffected, and logging stays opt-in at runtime because Log::init runs only when the app calls moq_log_level. This is a breaking change: builds that pass --features android-logcat stop resolving.
  2. Keep the feature and enable it where it is missing. Add android-logcat = ["moq-tokio/android-logcat"] to libmoq, and pass it in moq-ffi/build.sh for Android targets. Not breaking, but every Android consumer still has to know to turn it on.

I have (1) working locally and can send a PR for either; since (1) is breaking, I'd like your call before opening it.

(Written by Claude Opus 5.5)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questBeing tracked/planned in a quest. See `quest/`

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions