Search code examples
androidlogcat

Handling spaces in logcat


One of the external libraries that my app uses have spaces in its logcat tag:

Log.d("Some External Library", "Debug Message");

How do I write the filter-spec in the logcat command to handle spaces? Logcat inside eclipse was able to filter it but I prefer the command line.

I've tried the following and they don't work:

adb logcat -s "Some External Library"
adb logcat -s Some\ External\ Library
adb logcat -s Some External Library

Solution

  • So my advice would be to use an pipe. Write:

    adb logcat | grep 'Some External Library'
    

    Maybe someone else has another idea.

    If you need only debug messages write adb logcat '*:D' | grep 'Some External Library' for more possible tags write adb logcat --help

    The problem with this is, you can't use this solution in an adb shell environment, because the file-system there is read-only. But this solution should give you more or less the results you want.

    Commands like adb logcat -s 'Some External Library' or logcat -s '"Some External Library":D' are not working.