Android is a key grab Locat Log

Many small partner in the App do the test, an encounter Cash, develop students most often say, is to focus on the next Locat logs, many small partners heard the crawl log will feel irritated.

    There are 2 points:

    1, it is not likely to reproduce this bug

    2, may not know how to crawl faster log

    Here to share a little brother can grab second script Log log of Android, hope you can help small partners to solve this problem, well, do not say nonsense, directly on the code slightly!

    ​

import os
import sys

packageName=str(sys.argv[1])

command = "adb shell ps | grep %s | awk '{print $2}'"%(packageName)
p = os.popen(command)
##for some applications,there are multiple processes,so we should get all the process id
pid = p.readline().strip()
filters = pid
while(pid != ""):
pid = p.readline().strip()
if (pid != ''):
filters = filters + "|" + pid
#print 'command = %s;filters=%s'%(command, filters)
if (filters != '') :
cmd = 'adb logcat | grep --color=always -E "%s" '%(filters)
os.system(cmd)

The script is Python3, the execution, just open a terminal and type "

python3 locat_App_log.py com.yixia.quick8 "behind" com.yixia.quick8 "

App is your package name Ha. Come early adopters slightly junior partner

Guess you like

Origin www.cnblogs.com/QaStudy/p/11541519.html