Use Logcat to record logs to files and logcat logs

Source: Internet
Author: User

Use Logcat to record logs to files and logcat logs

In some development stages, a small part of the product has been distributed out. In the case of problems, we hope that users can send the Logcat logs at that time to programmers for analysis, here we will introduce a clever way to use the logcat command line to record logs without writing the log record code by yourself.

The Android shell provides a logcat command to view system logs. This command also supports log filtering and logging to files, it also supports Automatic Log File scrolling and controlling the log file size. Therefore, when the system starts, we can use Runtime to call the logcat command and start a process to record the logs we send through Logcat to the file, the following describes common parameters:

-V threadtime log output format, which can be brief process tag thread raw time threadtime long. -F/sdcard/filepath/log file output path-r51200 maximum size of a single log file: 51200kbytes-n 3 maximum size of 3 log files-s TAG1: V TAG2: D TAG3: w. Filter by TAG and level

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.