Kur*_*ain 13 logging android logcat
其中一个安卓模块(AudioFlinger)支持详细日志记录(使用Tag = AudioFlinger).问题是如何在logcat中看到这些日志?
我做了setprop log.tag.AudioFlinger VERBOSE - 但它似乎不起作用.我是否需要更改内容然后再重建android源代码?
Kur*_*ain 25
logcat文档并没有真正帮助.但是随着越来越多的挖掘,我能够找到答案,因为我期待的详细日志记录默认情况下关闭在编译的时候.
查看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.
*/
Run Code Online (Sandbox Code Playgroud)
因此,要为任何源文件/模块启用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'.
Run Code Online (Sandbox Code Playgroud)