Accepted answers:
- It's a known bug (url)
- It's a feature (url)
I can't figure out whether it's a bug or a feature of Android.
I have an app that calls Log.d()
and I periodically launch logcat on my device and usually it's full of messages - around 300kb/min, but sometimes it just stops showing my and most of other messages. I don't have a clue what could be the reason.
After reboot everything works again.
Strange thing, I use Log.d()
, but my messages are not there, but the log still contains some other rare D
messages
public class AaaTest extends AndroidTestCase {
public void testA() throws Exception {
Log.wtf("foobar", "loggableE = " + Log.isLoggable("foobar", Log.ERROR));
Log.wtf("foobar", "loggableW = " + Log.isLoggable("foobar", Log.WARN));
Log.wtf("foobar", "loggableI = " + Log.isLoggable("foobar", Log.INFO));
Log.wtf("foobar", "loggableD = " + Log.isLoggable("foobar", Log.DEBUG));
Log.wtf("foobar", "loggableV = " + Log.isLoggable("foobar", Log.VERBOSE));
Log.e("foobar", "this is error");
Log.w("foobar", "this is warning");
Log.i("foobar", "this is info");
Log.d("foobar", "this is debug");
Log.v("foobar", "this is verbose");
Log.e("foobar", "this is error again");
Log.wtf("foobar", "this is wtf");
}
}
_
adb logcat -v threadtime "*:S" "foobar:V"
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
05-21 20:06:36.601 16052 16068 F foobar : loggableE = true
05-21 20:06:36.629 16052 16068 F foobar : loggableW = true
05-21 20:06:36.652 16052 16068 F foobar : loggableI = true
05-21 20:06:36.672 16052 16068 F foobar : loggableD = false
05-21 20:06:36.686 16052 16068 F foobar : loggableV = false
05-21 20:06:36.808 16052 16068 E foobar : this is error
05-21 20:06:36.808 16052 16068 E foobar : this is error again
05-21 20:06:36.809 16052 16068 F foobar : this is wtf
Looks like isLoggable()
is completely unrelevant.
My device is Zopo ZP300+ with Android 4.0.4