I'm developing an Android app which is streaming serial data from some custom hardware. I'm using mik3y's usb-serial-for-android library to get the serial data over USB in OTG mode, which after some tweaks is working fine.
However, for every transaction over the USB interface, UsbRequestJNI
is logging an init
and close
message. This is swamping LogCat with thousands of log messages per second (note the timestamps):
02-17 09:30:21.590 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.590 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.594 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.594 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.598 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.598 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.602 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.602 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.606 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.606 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.610 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.610 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.614 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.614 2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
I know I can filter these in the IDE, but I want to stop them so they're not chewing through debugger bandwidth.
From what I can gather, UsbRequestJNI
is an operating-system-provided JNI library, so I can't just edit the source. So how can I tell it to stop logging these debug messages while still running a debug build so I can see other relevant debug info?
Googling around has produced only this, which is basically the same problem but with no resolution that's applicable here.
(My development device is running Android 4.3 and I'm developing on Android Studio 1.0.1)
UPDATE: Just found the source for UsbRequest, the relevant lines being ALOGD statments (lines 45 and 71). So I guess the question becomes: how do I suppress ALOGD messages?
UPDATE 2: I've tried setprop log.tag.UsbRequestJNI SUPPRESS
as per this answer, but frustratingly it has no effect on my device.
For posterity these messages seem to come from UsbRequest initialize() and close() methods so by reusing UsbRequest objects instead of creating new object mostly solves this issue and probably also marginally improve performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With