45
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.

Takermania
  • 1,345
  • 2
  • 12
  • 20
  • Offtopic: Why are you using DOS Promt, and not Eclipse for debugging? Or are you not debugging? – RvdK Dec 18 '12 at 11:18
  • use [this][1] link, it may be helpful [1]: http://stackoverflow.com/questions/7537419/how-to-filter-android-logcat-by-application – Aamir Shah Dec 18 '12 at 11:31
  • 2
    Are you sure you are not simply misspelling the tag on the command? Maybe your project actually uses _Legendary Eagle_, but you are searching for _Legendry Eagle_ (or vice versa). – Aleks G Dec 18 '12 at 11:34
  • 1
    Docs say `The series of specifications is whitespace-delimited.` so you can't use a space in the tag if you're trying to filter by it. – Tony Chan Oct 15 '13 at 19:25

6 Answers6

70

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

Ole
  • 7,899
  • 2
  • 29
  • 34
  • 2
    Docs say `The series of specifications is whitespace-delimited.` which is probably why his "Legendry Eagle" tag was failing to filter. – Tony Chan Oct 15 '13 at 19:24
  • +1 for the *:S. It really makes clear for me now how to use options – Marcelo Mar 13 '14 at 21:47
  • `The series of specifications is whitespace-delimited` because you're on the Windows command prompt, and when you're on the Windows command prompt, you can surround whitespace-using parameters with double quotes i.e. `"White Space Parameter"` to escape them. Think about `move "c:\android files" "c:\my code\android files"`. This means you should be able to do: `adb logcat "Legendary Eagle:Priority" *:S`. I cannot confirm exactly as I don't have any whitespace-using tags to test with, but this worked: `adb logcat "StatusBarManagerService:V" *:S` so that tells me it's on Windows and not adb. – Neptune Systems Sep 18 '15 at 21:13
  • 1
    @NeptuneSystems Even with double quotes only the first word is used by adb to filter the output. [Aleks G's answer](http://stackoverflow.com/questions/13931729/filtering-logcat-logs-on-commandline/13932016#13932016) provides a solution if you want to filter strings containing whitespaces. – Ole Sep 21 '15 at 10:33
  • >The *:S is important, as it sets all other tags to silent +1 thx a lot! – Matthias R. Oct 07 '15 at 11:53
  • You can use the -s option instead of *:S, in this case this would be "adb logcat -s MainActivity:V". – Eneko Jul 30 '19 at 10:01
22

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.

Aleks G
  • 56,435
  • 29
  • 168
  • 265
  • 1
    the extension with 'find xyz' solved my problem too, thx! (that's the minimal bit the internet won't tell you unless you perform a full 1-hour-research) – Matthias R. Oct 07 '15 at 11:54
  • This solved my problem. The *:S and -s approaches might be outdated. – Stewii Mar 27 '21 at 21:36
15
adb logcat | grep "your tag"

will only display logs with "your tag"

khizerbajwa
  • 304
  • 4
  • 11
5

Answer is very simple . Please remove space between two words and try again.

 public static final TAG = "LegendryEagle";
 adb logcat -s "LegendryEagle" 

and see the logcat . You got your answer.

Chirag
  • 56,621
  • 29
  • 151
  • 198
2

use this command adb logcat *:W and read this. http://developer.android.com/tools/debugging/debugging-log.html

urveshpatel50
  • 1,675
  • 16
  • 35
0

Assuming you are using Eagle as the logging tag, use this:

adb logcat Eagle:* *:s

as I understand the Eagle:* means to turn on all logs for the Eagle tag, and the *:s means to make all other tags silent

I personally find the eclipse logcat view much easier to use than the command line, it has different colors for different levels of logs, and you can create a filter and save it, it'll stay there forever until you delete that filter