android 日誌自動過濾器

來源:互聯網
上載者:User

android 日誌自動過濾器

在android的開發過程中,離開了eclipse,會不會碰到抓日誌很煩很煩的問題?

如果只想抓某個進程的日誌 是不是更煩?

一般的操作過程是這樣的:

第一步

adb shell

$ps

然後看到一大堆進程 找到自己想要的進程 看一下進程id 很痛苦啊 因為進程很多很多

第二步

$ logcat -v time | grep pid


圖省事就寫了個簡單的指令碼 可以運行在ubuntu或者mac的terminal下

內容如下

#!/bin/bash#get pid of protectserviceps_grep_res=$(adb shell ps | grep com.xxx.xxx)echo $ps_grep_respid=$(echo $ps_grep_res | awk '{print $2}')echo "pid=="$pid#print logcatadb logcat -v time | grep $pid
把上面的內容複寫到一個文本中 修改grep 後面的包名為你的包名 重新命名成為xx.sh 然後賦予執行許可權

然後就可以愉快的在命令列抓取日誌啦

具體執行方式很簡單 ./xx.sh


太懶圖省事 無圖無真相啊 不管你信不信 反正我是信了


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.