Dienstag, 10. August 2010

java.util.logging under Android

I just found out that log messages from java.util.logging are passed on to android.util.Log. Now that is pretty helpful for multi-platform development. By default only messages up and including INFO are copied across but you can adjust that.

Just in case you don't know how: 1st you need to change the Andoid log level using setprop on the device:

adb -e shell setprop log.tag.Main DEBUG


Then you also need to change the java logging level inside you program:

Main.logger.setLevel (java.util.logging.Level.FINER);


Last not least you need to remember that Android only allows 23 characters as logger name. Longer names will be shortened. Usually by removing the package name.

For me this is also one more reason not to use Log4J.

Keine Kommentare:

Kommentar veröffentlichen