Logger Decision Time

Posted: November 24, 2009 in Android, Java, Mobile
Tags:
A composite of the GNU logo and the OSI logo, ...
Image via Wikipedia

I am coding an open source Logger set of wrappers for Android Application developers.  Let me give some background.  Most of you at some time when you started android Programming(me too back than) were not aware that you could do this at debug time:

adb setprop log.tag.LOG_TAG DEBUG

before your connect the IDE debugger to the emulator or device. This basically means if I route all log calls say through log level DEBUG that it will only get executed, because I have use if statements with isLoggable, when DEBUG log level is enabled.

What confuses people in this doc of Log is the phrases LOG-TAG is set to default INFO and all above INFO including INFO or automatically executed and logged. Okay lets look at the javadoc more closely. INFO has a constant value of 4 so given the javadoc phrases than that should mean that constant 4 5 and 6 would be the ones logged, right?  Those are INFO(4), WARN(5), and ERROR(6).

So I do not have to route everything through DEBUG as I can still use INFO, WARN, and ERROR. But if I route through DEBUG than it kind of acts as another deterrent towards prevent reverse engineering because than you have noway to use such log messages to determine a class or method name but that than defeats getting usable remote logs from customers in case something goes wrong.

Thus, for now do not route all through DEBUG level log but do in fact wrap such IO expensive items as GLDEBUG etc as DEBUG level log and of course  re-route VERBOSE directly through the DEBUG level as we are only setprop on the DEBUG log level which means VERBOSE will still be off. Yes, in some Android versions VERBOSE is not  properly set off with if isLoggable hence my coding out a Logger set o wrappers.

Reblog this post [with Zemanta]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s