adb logcat to view the output log of a process


adb logcat does not have this function by default. I implemented a small bash function and added it to your $HOME/.bashrc file:


``` bash
# Function: can display log by process name
# Usage: alogcat com.android.calendar or alogcat calendar
# When the monitored process exits abnormally, you need to rerun this command
function alogcat() {
OUT=$(adb shell ps | grep -i $1 | awk '{print $2}')
OUT=$(echo $OUT | sed 's/[[:blank:]]\+/\|/g')
# When the process exits abnormally, the log is
adb logcat -v time |grep -E "$OUT|AndroidRuntime"
}
` ``
Calling method: replace

alogcat email email

with your packagename, the full name or part can be transferred from : http://www.yinqisen.cn/blog-515.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326579596&siteId=291194637