Log ' main ', ' System ', ' radio ', ' Events ' and Android log analysis

Source: Internet
Author: User
Tags system log dmesg
In Android, different logs are written to different devices. There are four types: / dev / log / system, / dev / log / main, / dev / log / radion, / dev / log / events. The default Log.v is written to / dev / log / main. Slog is written to / dev / log / system.

    When we use logcat to capture the date, we can specify buffer to request different ring buffers ('main', 'system', 'radio', 'events', the default is "-b main -b system") , Because the Android log system maintains multiple circular buffers for log messages, and not all messages are sent to the default buffer, to view these additional buffers, you can use the -b option, the following is the buffer that can be specified Area:   

main — View the main buffer (default buffer)

radio — View the messages contained in the wireless / telephone related buffer

events — View events related messages

    adb logcat -b <system, radio, events, main (default)>

1 Introduction to log file classification


            The main real-time printing are: logcat main, logcat radio, logcat events, tcpdump, and the Qualcomm platform will also have QXDM logs


          The status information includes: adb shell cat / proc / kmsg, adb shell dmesg, adb shell dumpstate, adb shell dumpsys, adb bugreport, engineering mode, etc.


 


2 LOG capture detailed explanation


l Real-time printing


      adb logcat -b main -v time> app.log print application log


    adb logcat -b radio -v time> radio.log print radio frequency related log, SIM STK will also be in it, modem related ATcommand, etc., of course, is far away from QXDM.


    adb logcat -b events -v time Print the log of system events, such as touch screen events. . .


    tcpdump is very useful, you can use this to capture TCP / IP protocol related, adb shell tcpdump -s 10000 -w /sdcard/capture.pcap, such as grab the UA profile when mms is downloaded, when the browser is online, Download using proxy's APN, and related contents of streaming include UA profile and so on.


    Finally, QXDM of the Qualcomm platform, whether it is Android or not, as long as you use the Qualcomm chip, you will be familiar with it. Of course, it is not necessary for Qualcomm chips to mention it. This is not much to say, rich in content, radio frequency, telephone, Internet, ... Any solution provided by Qualcomm, this can be caught. (Please refer to QPST and QXDM's basic instructions and functions for QXDM's LOG crawling method)


 


l Status information


o bugreport (command adb bugreport> bugreport.log). It contains dmesg, dumpstate and dumpsys.


o dumpstate is the system state information, which is relatively complete, including the current memory information of the phone, cpu information, logcat cache, kernel cache, etc.


o adb shell dumpsys This is about the system service content, this command has more detailed usage, such as adb shell dumpsys meminfo system is to view the memory information of the system process.


o kmsg crawl


adb shell cat / proc / kmsg> kmsg.txt, check msm_kgsl field after opening


Description: Used to retrieve kernel messages generated by printk. Only one process with super user rights can read this file at any time. You can also use the system call syslog to retrieve these messages. Usually use the tool dmesg or daemon klogd to retrieve these messages. proc is a memory file system. Every time you read the file kmsg is actually a circular buffer inside the kernel. After reading it, the circular buffer is considered to have been processed (that is, it becomes invalid content), so you read it again It is normal to be empty. Why is it handled this way? The size of the circular buffer is limited, and the kernel may write to it at any time, so this process is normal. You can check whether the information in / proc / kmsg is related to the system log If there is, you can read the log file


o dmsg crawl


adb shell dmesg> dmesg.txt


Note: dmesg is used to display the boot information, and the kernel will store the boot information in the ring buffer. If you are too late to check the information when you turn on the device, you can use dmesg to check it. dmesg is the log of the kernel. Anything related to the kernel, such as a problem with the driver (camera, Bluetooth, usb, boot, etc.), boot information is also saved in the file named dmesg in the / var / log directory. more / var / log / dmesg


 


o Log capture in engineering mode


            For Apollo mobile phone, please dial * # * # 8888 # * # *, and then tick the corresponding LOG. After the test is over, export the LOG to the PC via the SD card.


 


3.Log analysis:


Get Log from Android System


adb bugreport> bugreport.txt


copy bugreport to the current directory.


The bugreport contains various log information, and most of the logs can also be obtained directly by running related programs directly.


Proceed as follows :


1. adb shell 2. Enter the directory of related tools and programs 3. Run related programs 4. Get related information


The following takes the output process information as an example 1.adb shell 2. Enter ps -P 3. You can see the related process information


Log Archive Analysis


1.bugreport


bugreport records the log of the Android startup process, and the system status after startup, including process list, memory information, VM information, etc.


2.bugreport structure analysis


(1) dumpstate


MEMORY INFO


Get the log: read the file / proc / meminfo


System memory usage status


CPU INFO


Get the log: execute / system / bin / top -n 1 -d 1 -m 30 -t


System CPU usage status


PROCRANK


Get the log: execute / system / bin / procrank


Output the result after executing / system / xbin / procrank to view some memory usage status


VIRTUAL MEMORY STATS


Get the log: read the file / proc / vmstat


Virtual memory allocation


The memory requested by vmalloc is located between vmalloc_start ~ vmalloc_end, and there is no simple conversion relationship with the physical address. Although they are logically continuous, they do not require continuity physically.


VMALLOC INFO


Get the log: read the file / proc / vmallocinfo


Virtual memory allocation


SLAB INFO


Get the log: read the file / proc / slabinfo


SLAB is a type of memory allocator. Some information about the allocator is output here


ZONEINFO


Get the log: read the file / proc / zoneinfo


zone info


SYSTEM LOG (focus on analysis)


Get the log: execute / system / bin / logcat -v time -d *: v


Log output in the program will be output for analyzing the current state of the system


VM TRACES


Get the log: read the file /data/anr/traces.txt


Because each program is run in its own VM, this Log is some traces of the respective VM


EVENT LOG TAGS


Get the log: read the file / etc / event-log-tags


EVENT LOG


Get the log: execute / system / bin / logcat -b events -v time -d *: v


Output some Event logs


RADIO LOG


Get the log: execute / system / bin / logcat -b radio -v time -d *: v


Display the link status of some wireless devices, such as GSM, PHONE, STK (Satellite Tool Kit) ...


NETWORK STATE


Get the log: execute / system / bin / netcfg (to get the network link status)


Get the log: read the file / proc / net / route (get the routing status)


Show network links and routes


SYSTEM PROPERTIES


Get the log: Reference code implementation


Display some system properties, such as Version, Services, network ...


KERNEL LOG


Get the log: execute / system / bin / dmesg


Display the log output by the Android kernel


KERNEL WAKELOCKS


Get the log: read the file / proc / wakelocks


The kernel records some programs and services to wake up and sleep


KERNEL CPUFREQ


(Linux kernel CPUfreq subsystem) Clock scaling allows you to change the clock speed of the CPUs on the fly.


This is a nice method to save battery power, because the lower the clock speed is, the less power the CPU consumes.


PROCESSES


Get the log: execute ps -P


Show current progress


PROCESSES AND THREADS


Get the log: execute ps -t -p -P


Show current processes and threads


LIBRANK


Get the log: execute / system / xbin / librank


Eliminate unnecessary libraries


BINDER FAILED TRANSACTION LOG


Get the log: read the file / proc / binder / failed_transaction_log


BINDER TRANSACTION LOG


Get the log: read the file / proc / binder / transaction_log


BINDER TRANSACTIONS


Get the log: read the file / proc / binder / transactions


BINDER STATS


Get the log: read the file / proc / binder / stats


BINDER PROCESS STATE


Get the log: read the file / proc / binder / proc / *


some states related to bind


FILESYSTEMS


Get the log: execute / system / bin / df
Some capacity usage status of main files (cache, sqlite, dev ...)


PACKAGE SETTINGS


Get the log: read the file /data/system/packages.xml


Some status (access rights, path ...) of package in the system is similar to some lnk files in Windows.


PACKAGE UID ERRORS


Get the log: read the file /data/system/uiderrors.txt


Error message


KERNEL LAST KMSG LOG


Latest kernel message log


LAST RADIO LOG


Latest radio log


KERNEL PANIC CONSOLE LOG


KERNEL PANIC THREADS LOG


Some error messages of console / thread log


BACKLIGHTS


Get this log: Get LCD brightness read / sys / class / leds / lcd-backlight / brightness


Get the log: Get Button brightness read / sys / class / leds / button-backlight / brightness


Get the log: Get Keyboard brightness read / sys / class / leds / keyboard-backlight / brightness


Get this log: get ALS mode read / sys / class / leds / lcd-backlight / als


Get this log: Get LCD driver registers read / sys / class / leds / lcd-backlight / registers


Get some information about brightness


(2) build.prop


VERSION INFO outputs the following information
current time 
Current kernel version: can be obtained by reading the file (/ proc / version)
Display the current command: You can read the folder (/ proc / cmdline)
Display some properties of the system build: you can read the file (/system/build.prop) to get
Some attributes of the output system
gsm.version.ril-impl
gsm.version.baseband
gsm.imei
gsm.sim.operator.numeric
gsm.operator.alpha


(3) dumpsys


This log can be obtained after executing / system / bin / dumpsys.
It is often found that the log output is incomplete, because the code requires the tool to execute at most 60ms, which may cause the log to not be completely output.
You can modify the time parameter to ensure that the log is completely output.
Information:
Currently running services
DUMP OF SERVICE services-name (running)


Log Code Analysis


Site:. \ Frameworks \ base \ cmds \ dumpstate

The code of the related Log program can be obtained from the above directory


Log Analysis Experience


Analysis steps


1. View some version information
Identify the problematic system environment
2. Check the usage status of CPU / MEMORY
To see if there is any memory exhaustion, the CPU is busy, and the background situation appears.
3. Analyze traces
Because traces are some thread stack information output after a system error, you can quickly locate the problem.
4. Analysis of SYSTEM LOG
The system log outputs various logs in detail, you can find the relevant logs and analyze them one by one
 

Log analysis of 'main', 'system', 'radio', 'events' and android log
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.