fix: filter tracing to INFO for wzp crates, WARN for jni crate
The jni crate emits VERBOSE logs for every JNI method lookup (~10 lines per call, 100+ calls/sec on audio threads). This floods logcat, consumes CPU, and triggers system kills. Filter to only show INFO+ for our crates and WARN+ for everything else. Also fix build script: clean full Rust target to ensure libc++_shared.so is always copied by cargo-ndk. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ wzp-crypto = { workspace = true }
|
||||
wzp-transport = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
tracing-subscriber = { workspace = true, features = ["env-filter"] }
|
||||
bytes = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = "1"
|
||||
|
||||
@@ -41,8 +41,17 @@ fn init_logging() {
|
||||
let _ = std::panic::catch_unwind(|| {
|
||||
use tracing_subscriber::layer::SubscriberExt;
|
||||
use tracing_subscriber::util::SubscriberInitExt;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
if let Ok(layer) = tracing_android::layer("wzp_android") {
|
||||
let _ = tracing_subscriber::registry().with(layer).try_init();
|
||||
// Filter: INFO for our crates, WARN for everything else.
|
||||
// The jni crate emits VERBOSE logs for every method lookup
|
||||
// (~10 lines per JNI call, 100+ calls/sec) which floods logcat
|
||||
// and causes the system to kill the app.
|
||||
let filter = EnvFilter::new("warn,wzp_android=info,wzp_proto=info,wzp_transport=info,wzp_codec=info,wzp_fec=info,wzp_crypto=info");
|
||||
let _ = tracing_subscriber::registry()
|
||||
.with(layer)
|
||||
.with(filter)
|
||||
.try_init();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -196,6 +196,12 @@ do_upload() {
|
||||
do_build() {
|
||||
log "Building Rust native library (arm64-v8a, release)..."
|
||||
|
||||
# Clean Rust release target to force full rebuild.
|
||||
# cargo-ndk only copies libc++_shared.so when it actually links — a partial
|
||||
# clean that skips relinking leaves libc++_shared.so missing from jniLibs.
|
||||
ssh_cmd "rm -rf /root/wzp-build/target/aarch64-linux-android/release \
|
||||
/root/wzp-build/android/app/src/main/jniLibs/arm64-v8a"
|
||||
|
||||
# ANDROID_NDK must be set (not just ANDROID_NDK_HOME) — cmake checks it
|
||||
ssh_cmd "source \$HOME/.cargo/env && \
|
||||
export ANDROID_HOME=\$HOME/android-sdk && \
|
||||
|
||||
Reference in New Issue
Block a user