Android Studio includes a Logcat tab in Android Monitor that can print system events, such as when garbage collection occurs, to print app messages in real time.
To display the information you need, you can create a filter to change how much information you need to display. Set the priority layer, display the message that the app prints, or search the log. By default. The LOGCAT monitor displays the log output of the most recently run app.
When an application throws an exception, the Logcat monitor displays a corresponding message.
Writing a log message
You can print the following log:
1, LOG.E (string,string) (output error)
2, LOG.W (string,string) (warning)
3, LOG.I (string,string) (information)
4, LOG.D (string,string) (commissioning)
5, LOG.V (string,string) (verbose)
LOGCAT Message Format
The following format:
Date Time Pid-tid/package Priority/tag:message
Display a running app in the Logcat monitor
1. Open a project
2. Run your app in a device or virtual machine
3. Display Android Monitor
4. Click the Logcat tab
By default, the LOGCAT monitor only displays log information for your running apps in your device or virtual machine:
Setting the log level
There are the following levels:
1. Verbose: Displays all log messages.
2. Debug: Displays the log messages that are useful during the development process.
3. Info: Show some common information
4, Warn: Display the warning message.
5. Error: Displays the errors log message.
6. Assert: Shows what the developer expects not to happen.
This article Song Zhihui
Personal Weibo: Click to enter
5.1. Android Studio writing and viewing logs with Logcat