androidloggingnexus-one

Android logging levels


I'm having a little difficulty configuring Android logging. Here's what my code looks like:

    if (Log.isLoggable("MY_TAG", Log.VERBOSE)) {
        Log.v("MY_TAG", "Here's a log message");
    }

Pretty simple, right?

However, I'm having quite a bit of difficulty getting the Log.isLoggable("MY_TAG", Log.VERBOSE) to return true.

Per http://developer.android.com/reference/android/util/Log.html, I tried adding a local.prop file to the /data/ directory which looks like this:

log.tag.MY_TAG=VERBOSE

but no luck. I also tried:

System.setProperty("log.tag.MY_TAG", String.valueOf(Log.VERBOSE));

but that doesn't work either.

Any ideas on what I'm doing wrong here? I'm running Android 2.1-update1 on a Nexus 1 if that makes any difference.


Solution

  • Try

    adb shell setprop log.tag.MyAppTag VERBOSE