其中一个安卓模块(AudioFlinger)支持详细日志记录(使用Tag = AudioFlinger)。问题是如何在logcat中看到这些日志?
我做了setprop log.tag.AudioFlinger VERBOSE - 但它似乎不起作用。我是否需要更改内容然后再重建android源代码?
logcat文档并没有真正帮助。但是通过更多挖掘,我能够找到答案,因为我期望VERBOSE日志记录在编译时默认为OFF。
查看cutils / log.h有助于找到答案: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.
*/
因此,要为任何源文件/模块启用VERBOSE:我们必须将LOG_NDEBUG定义为0
使用以下任何一种方法。
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'.