Thanks Dianne, you answered my question already :-)

I thought there would be a switch, such as a macro definition like
"LOG_NDEBUG" for Log.v() in Java code as well. Then I found out it is
not the case, different pieces of Java code are in charge of turning
on/off verbose log on themselves. Like you said, they are always put
in if() wrappers.

I also thought of using an environment variable as one-stop switch to
turn on/off verbose log for all source files during compilation. Then
I realized it might not going to be useful, because people, or at
least I only debug one or two modules at one time. And loads of
verbose output from other modules in "adb logcat" are just going to be
annoying.

/Song

On Apr 16, 10:27 am, Dianne Hackborn <hack...@android.com> wrote:
> I'm not sure what you are asking.  They -are- turned off by default for the
> C code, as the comment says.  If force them to be turned on...  well then
> you are forcing them to be turned on, and if you don't want that, then don't
> do it. :}
>
> For Java code, NO code should ever be calling Log.v() without an if()
> wrapper around it that is turned off by default.  For example, you  will
> typically see:
>
>     final static String TAG = "MyClass";
>     final static boolean localLOGV = false;
>
>     ...
>
>     if (localLOGV) Log.v(TAG, "...");
>
> On Thu, Apr 16, 2009 at 1:01 AM, 袁嵩 Yuan Song <ilovewu...@gmail.com> wrote:
>
>
>
>
>
>
>
> > In system/core/include/cutils/log.h, it is mentioned in the comments
> > as follows:
>
> > /*
> >  * Normally we strip LOGV (VERBOSE messages) from release builds.
> >  * You can modify this (for example with "#define LOG_NDEBUG 0"
> >  * at the top of your source file) to change that behavior.
> >  */
>
> > So I tried to put "#define LOG_NDEBUG 0" in frameworks/base/libs/ui/
> > EventHub.cpp and re-compile. I do get verbose messages when I do "adb
> > logcat EventHub:v".
>
> > Now the question is whether there is a way to sort of turn verbose
> > messages on during compilation globally, both for "LOGV()" in the C
> > file and "Log.v()" in the Java file.
>
> > Appreciation for any of your thoughts.
>
> > /Song
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to