Search code examples
cmdadblogcatandroid-logcat

Exclude the tag string when using adb logcat in CMD


When using adb logcat in CMD, is there a way to have the log only show the String I am writing to the log, and not the tag along with random numbers? Right now, for example, it says:

"D/MainActivity( 970): myString"

I just want it to say myString, where myString is whatever I wanted to log.


Solution

  • The log record format is fixed. Every record saved to the log will include all the fields. But you can control which fields get printed out:

    -v <format>     Sets the log print format, where <format> is:
    --format=<format>
                      brief color epoch long monotonic printable process raw
                      tag thread threadtime time uid usec UTC year zone
    

    raw is the format you are looking for

    adb logcat -v raw