简体   繁体   中英

Get command line `adb logcat` output similar to Android studio's built in Android Monitor

So Android Studio has a very useful Android Monitor that shows logs specific to my application and everything going on with it; I've tried a few hours to get a logcat from the adb command line that is similar but I'm not getting even close. Specifically I just want the logs from my application, Info level or better. Thank you for whatever help you can provide.

In other words: what parameters can I add to adb logcat in order to see logs similar to what you would see inside the Android Studio, Android Monitor view.

Try this:

adb shell "logcat | grep filter"

"filter" could be "you app pid)", or "the TAG".
Like this:

adb shell "logcat | grep 12345)"
adb shell "logcat | grep com.xxx.yyy"

If using Windows,you can do this:

adb logcat | findstr filter

With this command you can have the same log style as is in Android studio, in a file.

One shot:

 adb  logcat -vD -vthreadtime -vUTC -d > yourfile.txt

Continuous:

 adb  logcat -vD -vthreadtime -vUTC > yourfile.txt

When you connect your device with pc you can see adb log by android monitor in android studio or command like as adb logcat -v . When you close your app, the connection with your app have closed. You have two way to check log:

  • in logcat window select No Filter or Edit Filter configuration
  • Using keystring, Example Samsung device using *#9900#

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM