View logcat
suggest changeYou 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 has these log levels:
V — Verbose, D — Debug, I — Info, W — Warning, E — Error, F — Fatal, S — Silent
S (Silent) is a filter priority. It is not a level that messages are logged at.
You can filter logcat by priority. *:D shows Debug and higher, not Debug alone:
adb logcat *:D
The filter syntax is tag:priority, not a package name. This shows MyTag at Debug and higher and suppresses every other tag:
adb logcat MyTag:D *:S
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 a file:
adb logcat > logcat.txt
Save output in file while also watching it:
adb logcat | tee logcat.txt
Cleaning the logs:
adb logcat -c