2012-10-22 54 views

回答

2

這是LogCat定義,從Developer Page - LogCat

logcat 

The Android logging system provides a mechanism for collecting and viewing system debug 
output. Logs from various applications and portions of the system are collected in a 
series of circular buffers, which then can be viewed and filtered by the logcat command. 
You can use logcat from an ADB shell to view the log messages. 

好,你把你需要的東西通過採取過濾的標籤,通過進程ID,通過字符串或者一個表達式。 無論如何,如果你沒有太多熟悉Logcat,請先嚐試這個指南 - Learn how to control Logcat output

+0

您鏈接頁面上的標籤/優先系統是偉大的,謝謝!我現在正在使用'adb logcat MyAppTag:V'*:W'',它顯示了我的應用程序中的所有內容以及其他任何警告。 – gatoatigrado

0

一種選擇是使用命令行。

appname=YOUR_APP_NAME_OR_LOG_TAG 
adb logcat | awk '/'$appname'/{gsub(/'$appname'/, "\x1b[95m'$appname'\x1b[0m"); print; next}; /(dalvikvm|com.google.android.apps|PhoneStatusBar|DeviceConfig)/{next}; {print}' 

這將突出你的應用程序的名稱,刪除包含通常垃圾郵件信息,並打印任何它不知道。

7

此外,如果你想過濾日誌,你不感興趣的則logcat中的「FILTER_SPEC」沉默的選項(S)消息可以使用。

例如,如果你要過濾的Dalvik虛擬機的日誌形式交往就像

d/dalvikvm(28039):GC_CONCURRENT釋放473K,7%免費9503K/10180K,暫停2MS + 3ms內,共有22毫秒

,那麼你可以使用

adb logcat dalvikvm:S