Recently learned to use the ADB command to capture the app flash back log;
1) on the cmd command line, you can use the ADB logcat command to view the log of the Android system, or you can use the ADB shell to enter the ADB Shell dedicated command line
2) DOS window can be directly input log, or directed output to TXT file;
3) Press CTRL + C interrupt input log record;
Each log of the Android output has a tag and priority associated with it.
The priority is the following character, in order from low to High:
V-Detail verbose (lowest priority)
-D Debug Debug
I-Info info
W-Warning warn
E-Fault Error
F-Critical Error fatal
S-No record silent
How to use each command can be viewed by: https://www.cnblogs.com/mgzc-1508873480/p/7116207.html
the focus of this session:
1. If you want to filter a specific level of logging, use the following command:
ADB logcat *:w//Show all logs with priority greater than or equal to "warning"
2. Add the package name filter log:
Add two files in the ADB directory Getpid.bat and Getpid1.bat:
1.getpid.bat
@echo off
adb Shell "PS | grep xxx "
where "XXX" is the package name
2.getpid1.bat
Method 1: Print the log directly in CMD; log no filter
@echo off
for/f "tokens=2 delims="%%i in (' Getpid.bat ') do set pid=%%i
Echo%pid%
ADB Logcat | Find "%pid%"
Pause
Method 2: Print the log directly in cmd, log filtering, such as filtering E and E-level above the log;
@echo off
for/f "tokens=2 delims="%%i in (' Getpid.bat ') do set pid=%%i
Echo%pid%
ADB Logcat *:e | Find "%pid%"
Pause
You can also modify the Add directed output to TXT file on Method 2: adb logcat *:e | Find "%pid%" > MYAPP1.txt
operating mode:
1. Connect the phone, enter the ADB devices in CMD and check if the device is connected properly;
PS: Connection is not normal, you can refer to the following blog: https://www.cnblogs.com/sxming/p/7928361.html
2. Double-click Getpid1.bat to run; Then open the app to crawl the log
3. Finally CTRL + C ends
ADB logcat filter logs via package name and output to TXT file