Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filtering Logcat Logs on commandline

Tags:

android

logcat

public static final TAG = "Legendry Eagle"; 

Issue: I want to see logs of "Legendry Eagle" from the commandline.

I tried:

 adb logcat -s "Legendry Eagle"   adb logcat -s <Legendry Eagle> 

But Still it is not working.

like image 689
Takermania Avatar asked Dec 18 '12 11:12

Takermania


People also ask

How do I read Logcat logs?

View your app logs To display the log messages for an app: Build and run your app on a device. Click View > Tool Windows > Logcat (or click Logcat in the tool window bar).

What is adb Logcat command?

Android logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that are written by applications with the "Log" class.

What is PID in Logcat?

pid = process ID. uid = user ID of the application that owns that process.


2 Answers

If you only want to show logcat for a specific TAG, do it like this:

adb logcat YourTAGHere:Priority *:S 

The *:S is important, as it sets all other tags to silent. If I want to track only my MainActivity tag at Verbose level, the syntax would look like this.

adb logcat MainActivity:V *:S 

Edit: I found no good way of filtering out tags with spaces. LegendryEagle works fine, but I was not able to filter out Legendry Eagle

like image 117
Ole Avatar answered Oct 02 '22 07:10

Ole


If the standard adb logcat -s tagname doesn't work, you can always pipe the output of adb to find to filter what you need, something like

adb logcat | find "Legendry Eagle" 

This passes the entire logcat to DOS find command, which in turn filters out rows containing Legendry Eagle string.

like image 45
Aleks G Avatar answered Oct 02 '22 07:10

Aleks G