2011-11-01 77 views
12

其中一个android模块(AudioFlinger)支持详细日志记录(使用Tag = AudioFlinger)。 问题是我如何在logcat中看到这些日志?如何获得特定模块的logcat的详细日志记录

我做了setprop log.tag.AudioFlinger VERBOSE - 但它似乎没有工作。我是否需要更改某些内容,然后重新构建Android源代码?

+0

您是如何查看LogCat输出的?在日食中,只需要DDMS或其他方式? – NotACleverMan

+0

我使用adb外壳,然后简单logcat。只需在这里添加,我就可以看到来自同一模块的其他日志级别,例如LOGE - 但只是LOGV不会来 - 所以我认为这是一个编译时间标志,必须启用 - 只是似乎无法找到启用的地方 – KurtCobain

回答

24

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. 
*/ 

所以启用详细任何源文/模块:我们必须定义LOG_NDEBUG为0

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'. 
相关问题