dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Dioxus Logging Is Not Working On Android

Open mcmah309 opened this issue 8 months ago • 1 comments

Problem

On android, no logs appear when log statements are hit. I was not able to verify if this is an IOS issue as well.

Also reported by other users: https://discord.com/channels/899851952891002890/943190605067079712/1358174691495378945

Environment:

  • Dioxus version: 0.6.3
  • Rust version: 1.87, nightly
  • OS info: NixOS 25.05
  • App platform: android

mcmah309 avatar Apr 08 '25 10:04 mcmah309

I do not believe the logger currently supports mobile. We'd need to find or create a tracing subscriber that hooks into Android's Log class and another for iOS. I'm not sure about iOS, but the CLI also needs to hook into adb logcat to output the logs.

DogeDark avatar Apr 08 '25 17:04 DogeDark

On mobile logs are currently printed on a device, so you can use adb logcat on Android. I don't know though, how to get logs from iOS into a console. For Android I use the following command to get clean log from Dioxus:

adb logcat -s -v time -v year RustStdoutStderr | sed -E '/(s_glBind|FORTIFY: |\.cc:[0-9]+]|\.h:[0-9]+])/d; s|([0-9-]+) ([0-9:]+)\.([0-9]+) I/RustStdoutStderr\(\s*[0-9]+\):(.*)|\2 \4|g; s/DEBUG/🔵 /g; s/ INFO/🟢 /g; s/ WARN/🟡 /g; s/ERROR/🔴 /g'

If you need to show logs from the currently running app only, add the following parameter to adb logcat:

--pid=$(adb shell pidof -s $(grep identifier Dioxus.toml | cut -d'"' -f 2))

The downside is that in this case logs stop coming after a Dioxus reload or restart.

priezz avatar Jul 24 '25 15:07 priezz

This was just implemented thanks to a community contribution!

https://github.com/DioxusLabs/dioxus/pull/4853

jkelleyrtp avatar Oct 28 '25 19:10 jkelleyrtp