Using the Logcat
Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class.
The Logcat output can be displayed within Android Studio’s Android Monitor or with adb command line.
In Android Studio
Show by clicking the “Android Monitor” icon: Or by pressing Alt+6 on Windows/Linux or CMD+6 on Mac.
via command line:
$ adb logcat
$ adb logcat -v time
Filter on specific text:
$ adb logcat -v time | grep 'searchtext'
There are many options and filters available to command line logcat, documented here. A simple but useful example is the following filter expression that displays all log messages with priority level “error”, on all tags:
$ adb logcat *:E