5.1. Android Studio writing and viewing logs with Logcat

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.