Monday, October 19, 2009

[android-developers] Re: Logging in Android

The work arounds get the job done and might be preferable to
isLoggable anyway if the calls to isLoggable are at all expensive.

It is worth understanding how the SDK instrumentation tools work (or
not, in which case maybe isLoggable should be deprecated?).

It seems like a good idea to use android.util.Log since this is
coordinated with Logcat filtering in adb, emulator, and ddms, etc.,

java.util.logging (and log4j, etc.) have the nice feature of turning
on logging for subsystems (e.g., com.foobar.myapp turns on app-wide
logging, com.foobar.myapp.myactivity turns on logging for just the
activity, and so forth). The android.util.Log tags don't have that
feature AFAIK. I don't know if it is possible to get
java.util.logging to write into the buffers that Logcat uses (so
logcat filtering would work) or where you would put the configuration
file so it is installed with your app.

In that regard I'm also not sure if it is possible to get the
configuration file for android.util.Log installed with the app rather
than in a shared location as suggested in the API docs (/data). But
this is moot if isLoggble doesn't work.

On Oct 19, 12:40 am, RichardC <richard.crit...@googlemail.com> wrote:
> Yes I know, I was just trying to show the approach the the Google
> platform team (Dianne Hackborn) was taking.  If they are unable to
> strip debugging then at the moment we have no chance :)
>
> --
> RichardC
>
> On Oct 19, 6:38 am, jotobjects <jotobje...@gmail.com> wrote:
>
> > That thread was about various ad hoc ways that developers are cooking
> > up to strip logging and that if you do it wrong you will still be
> > evaluating the logging statements even if they are not output  (i.e.,
> > common sense Java).   Apparently developers are working around the
> > fact that there is no log stripping at compile time as documented and
> > perhaps the android.util.Log.isLoggable mechanism also doesn't work as
> > documented (if the setprop did take effect immediately to control
> > logging that would be cool).
>
> > On Oct 17, 12:08 pm, RichardC <richard.crit...@googlemail.com> wrote:
>
> > > See this thread:http://groups.google.com/group/android-developers/browse_thread/threa...
>
> > > Specifically the responses by Dianne Hackborn
>
> > > --
> > > RichardC
>
> > > On Oct 17, 7:50 pm, jotobjects <jotobje...@gmail.com> wrote:
>
> > > > On Oct 17, 7:03 am, Christine <christine.kar...@gmail.com> wrote:
>
> > > > > On Oct 16, 12:51 am, 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?
>
> > > > > Read a message before you reply. Yusuf just said that debug logging is
> > > > > stripped at compile time.
>
> > > > Hi Christine - thanks for that pointed advice.  Actually I did read
> > > > the message and my experience is that debugging is not stripped at
> > > > compile time.  That was the reason for my confusion.  Yusuf just
> > > > quoted the documentation which I have read and reread and tested,  So
> > > > I'm posting the question because evidently I'm not getting something
> > > > about how android.util.Log is supposed to work.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

No comments:

Post a Comment