[android-developers] Re: Logging in Android
Logging isn't compiled out automatically in my experience. I can add
verbose and debug level logging statements like these:
Log.v(LOG_TAG, "Verbose test.");
Log.d(LOG_TAG, "Debug test.");
and the output of both show up in "adb logcat" even if I have
debugging off in the application's manifest and am running an APK
signed with a non-debug signing key. This is using the 1.6 SDK and
testing on a T-Mobile G1 running the OTA 1.6 firmware.
The equivalent Log.isLoggable calls:
Log.isLoggable(LOG_TAG, Log.VERBOSE)
Log.isLoggable(LOG_TAG, Log.DEBUG)
both return false at the same time. So apparently the Log.v and Log.d
methods don't even check isLoggable for you at runtime.
Looks like appropriate if statements must be manually added in front
of the log calls if you actually want them compiled out or not used at
runtime for the time being.
On Oct 15, 6:51 pm, jotobjects <jotobje...@gmail.com> wrote:
> This is still a little unclear to me. AFAIK this is a recommendation
> to strip out debug logging - logging is not automatically stripped?
>
> Is there a mechanism for setting the log level as with Log4J and
> java.util.logging and commons logging? I haven't been able to get the
> Log.isLoggable() method to do anything useful. It returns true for
> INFO and false for DEBUG even when I use adb shell setprop as
> instructed.
>
> On Oct 15, 2:49 pm, "Yusuf Saib (T-Mobile USA)" <Yusuf.S...@T-
>
> Mobile.com> wrote:
> > Fromhttp://developer.android.com/reference/android/util/Log.html#d(java.l...
>
> > "Verbose should never be compiled into an application except during
> > development. Debug logs are compiled in but stripped at runtime.
> > Error, warning and info logs are always kept."
>
> > Yusuf Saib
> > Android
> > ·T· · ·Mobile· stick together
> > The views, opinions and statements in this email are those of the
> > author solely in their individual capacity, and do not necessarily
> > represent those of T-Mobile USA, Inc.
>
> > On Oct 15, 1:01 pm, vj <vjvdixit.l...@gmail.com> wrote:
>
> > > I understand it is meant for filtering out "logcat" messages, but on
> > > what
> > > basis would a developer know when to use which type of API ?
>
> > > On Oct 15, 2:50 pm, vj <vjvdixit.l...@gmail.com> wrote:
>
> > > > What is the significance of having different "priority" levels in the
> > > > Log API ? I am referring to .e(), .d() etc. Also, considering the fact
> > > > that all the priorities are going to be logged in any case, on what
> > > > basis would a developer know when to use which type of API ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home