【51CTO.com Quick Translation】It is well known that logs play an important role in the entire development life cycle of application products. For example: during the software development process, error logs can help developers identify logical errors in the program in a timely manner; and after the product is released to the market, support engineers can solve various difficult and complicated problems by analyzing error logs. In our commonly used Android system, various logs are centrally managed by default. Of course, there are many tools on the market that can be used to develop Android applications, which allow application developers to write custom log messages and various filters defined by specific log statements. Currently, the Android ecosystem provides different types of logs, including: application logs, system logs, event logs, and radio logs. The logging system consists of a kernel driver and kernel buffer (for storing Android log messages), C, C++, and Java classes that can be used to create log entries and access log messages, a standalone program that can be used to view log messages (logcat), and components such as viewing logs and filtering log messages from the host (through eclipse or ddms). The Linux kernel of the Android system has four different log buffers, which provide logging for different parts of the system. For example, through the device node /dev/log in the file system, we can access Android's four log buffers: main, event, radio, and system. The main log is used for applications, event is used for system event information, radio is used for phone related information, and system is related to low-level system messages and debugging. Each message in the log contains a tag that tells us: which part of the system or application the message came from, the timestamp (when the message arrived), the log level of the message (or the priority of the event the message represents), and the body of the log message itself (detailed description of the error, exception, or information). Four major log types in the Android system: 1. Application log
2. System log
3. Event Log
4. Broadcast log
Log format on Android The common log format in the Android system is: tv_sectv_nsec priority pidtid tag messageLen Message. Among them:
Log file location In principle, Android logs (including crash logs) can be stored in multiple places, and there is no requirement for a standardized directory (i.e., specific to the system's ROM). Here, we introduce some commonly used and common directories:
"Log" related command line tools In actual projects, we can use various applications or command line tools to capture relevant logs generated on Android from devices or emulators, and then share them with various developers or maintainers so that they can conduct in-depth analysis. The following are three commonly used commands:
Useful filter patterns To reduce the amount of data, you can use the following filter in the adb command (see https://www.pcloudy.com/executing-adb-shell-commands/) to reduce the total amount of logs. Of course, you can also use such filters to search the log files on the user's Android device.
Log analysis So far, we have a basic understanding of Android's log system. In actual analysis, we usually focus on two types of application logs, which are:
We can use tools such as GoogleLogTool and SonyLogTool to perform in-depth analysis by adopting filter patterns. Original title: Android Log Analysis, Author: Bala Murugan [Translated by 51CTO. Please indicate the original translator and source as 51CTO.com when reprinting on partner sites] |
<<: The 5G era is coming. How long will it take for smartphones to become obsolete?
[[379259]] This article is reprinted from the WeC...
Whether it is a sci-fi movie with lifelike shots ...
Here, I will take the education industry as an ex...
Regarding traffic , some people say: There must b...
From driverless cars to software engineering, fro...
Whether it is an online or offline activity; whet...
What is the most expensive seafood you have ever ...
Replay is a video editing software with similar f...
This article will introduce three commonly used a...
Hello everyone, I would like to share with you th...
Author: Wang Guanqun, Pan Haochen, Fang Xiang, Li...
In the Harry Potter film series, There is a langu...
The weather has warmed up, the trees have started...
Goldfish spend most of their time swimming gracef...
Today, we are not going to talk about “sample fan...