How to get Verbose logging in logcat for a specific module

青春壹個敷衍的年華 提交于 2019-12-06 18:36:32

问题


One of the android Modules (AudioFlinger) has support for verbose logging (with Tag=AudioFlinger). Question is how can I see those logs in the logcat?

I did the setprop log.tag.AudioFlinger VERBOSE - but it doesn't seem to work. Do I need to change something and then rebuild the android source again?


回答1:


The logcat documentation doesn't really help. But with more digging I was able to find the answer, as I was expecting the VERBOSE logging is by default OFF at compile time.

Looking at the cutils/log.h helps to find the answer: http://www.netmite.com/android/mydroid/system/core/include/cutils/log.h

/*
 * 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 to enable VERBOSE for any source file/module : We have to define LOG_NDEBUG as 0




回答2:


Use any of the below methods.

1) Add or uncomment "`#define LOG_NDEBUG 0`" at top of any module file.
2) In Android.mk or <module>.mk file, add `LOCAL_CFLAGS += -DLOG_NDEBUG=0`

In logcat, logcat | grep -E 'tag1|tag2'.


来源:https://stackoverflow.com/questions/7964685/how-to-get-verbose-logging-in-logcat-for-a-specific-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!