ADB logcat Filter by package name (DOS command find followed by variable)

Source: Internet
Author: User

The ADB command does not appear to be filtered directly by registration, but it can filter the application's log by filtering the PID of the process

Filter Condition: The app is running

Implementation principle:

1. Get the PID when the app is running

2, through the Find command, filter the log of the PID, is the operation of the package log

Realize:

1. Create a file in the same directory: Getpid.bat

@echo offadb Shell "PS | grep Com.example.testprogram "
Copy the above code to save

2, in the same directory to establish another question file: Getpid1.bat

@echo offfor/f  "tokens=2 delims="%%i in (' Getpid.bat ') do set Pid=%%iecho%pid%adb Logcat | Find  "%pid%" pause

Copy the above code and save

Link phone, launch com.example.testprogram this app

Double-click Getpid1.bat to get the log for the program:

D/DALVIKVM (9017): late-enabling Checkjnii/activitymanager (2272): Start proc Com.example.testprogram for activity com.example.testprogram/. mainactivity:pid=9017 uid=10070 gids={50070, 1028}d/libegl (9017): Loaded/system/lib/egl/libegl_mali.sod/libegl (901 7): Loaded/system/lib/egl/libglesv1_cm_mali.sod/libegl (9017): loaded/system/lib/egl/libglesv2_mali.soe/(9017         ): Device Driver API matche/(9017): Device driver API version:17e/(9017): User Space API Version:17 e/ (9017): Mali:revision=linux-r3p1-01rel1 build_date=tue Jul 2 15:06:24 KST (d/openglrenderer): 9017 G Debug Mode 0d/tag (9017): It ' s a log! D/androidruntime (9017): Shutting down VMW/DALVIKVM (9017): Threadid=1:thread exiting with uncaught exception (group=0x41 8dc700) E/androidruntime (9017): FATAL exception:maine/androidruntime (9017): Java.lang.ArithmeticException:divide by Zeroe/androidruntime (9017): at Com.example.testprogram.mainactivity$2.onclick (mainactivity.java:33) E/androidruntime (9017): at Android.view.View.performClick (view.java:4247) e/androidruntime (9017): at Android.view.view$performclick.run (view.java:17728) e/androidruntime (9017): at Android.os.Handler.handleCallback ( handler.java:730) E/androidruntime (9017): at Android.os.Handler.dispatchMessage (handler.java:92) E/androidruntime ( 9017): At Android.os.Looper.loop (looper.java:137) e/androidruntime (9017): at Android.app.ActivityThread.main ( activitythread.java:5289) E/androidruntime (9017): at Java.lang.reflect.Method.invokeNative (Native Method) e/ Androidruntime (9017): at Java.lang.reflect.Method.invoke (method.java:525) e/androidruntime (9017): at Com.android.internal.os.zygoteinit$methodandargscaller.run (zygoteinit.java:739) E/AndroidRuntime (9017): at Com.android.internal.os.ZygoteInit.main (zygoteinit.java:555) e/androidruntime (9017): at Dalvik.system.NativeStart.main (Native Method) i/process (9017): Sending signal. pid:9017 Sig:9i/activitymanager (2272): Process com.example.teStprogram (PID 9017) has died. W/inputmethodmanagerservice (2272): Got remoteexception sending setActive (FALSE) notification to PID 9017 UID 10070


ADB logcat Filter by package name (DOS command find followed by variable)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.