Android View logcat


Example

You can run logcat as an adb command or directly in a shell prompt of your emulator or connected device. To view log output using adb, navigate to your SDK platform-tools/ directory and execute:

$ adb logcat

Alternatively, you can create a shell connection to a device and then execute:

$ adb shell
$ logcat

One useful command is:

adb logcat -v threadtime

This displays the date, invocation time, priority, tag, and the PID and TID of the thread issuing the message in a long message format.


Filtering

Logcat logs got so called log levels:

V — Verbose, D — Debug, I — Info, W — Warning, E — Error, F — Fatal, S — Silent

You can filter logcat by log level as well. For instance if you want only to output Debug level:

adb logcat *:D

Logcat can be filtered by a package name, of course you can combine it with the log level filter:

adb logcat <package-name>:<log level>

You can also filter the log using grep (more on filtering logcat output here):

adb logcat | grep <some text>

In Windows, filter can be used using findstr, for example:

adb logcat | findstr <some text>

To view alternative log buffer [main|events|radio], run the logcat with the -b option:

adb logcat -b radio

Save output in file :

adb logcat > logcat.txt

Save output in file while also watching it:

adb logcat | tee logcat.txt

Cleaning the logs:

adb logcat -c