Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 318
seanoshea Avatar asked Nov 08 '10 18:11

seanoshea


People also ask

What is the logging level in phone?

Android supports various log levels, Verbose, Debug, Info, Warn and Error.

What is best logging level?

Some of them are important, others less important, while others are meta-considerations. The standard ranking of logging levels is as follows: ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < OFF.


1 Answers

Try

adb shell setprop log.tag.MyAppTag VERBOSE 
like image 109
Emmanuel Avatar answered Sep 27 '22 17:09

Emmanuel