System exception tracking, System

Source: Internet
Author: User

System exception tracking, System
DropBox captures relevant information at the following time:
A. Before an abnormal ShutdownSystemServer collects the following types of errors: watchdog, anr, wtf, lowmem, native_crash, crashTAG = watchdog, anr, wtf, lowmem, native_crash, crash

In this case, the ActivityManagerService. addErrorToDropBox () interface is used to collect information and add it to DropBox. In this case, addErrorToDropBox () is used to intercept and capture more logs:

12883    public void addErrorToDropBox(String eventType,
12884 ProcessRecord process, String processName, ActivityRecord activity,12885 ActivityRecord parent, String subject,12886 final String report, final File logFile,12887 final ApplicationErrorReport.CrashInfo crashInfo) {12888 // NOTE -- this must never acquire the ActivityManagerService lock,12889 // otherwise the watchdog may be prevented from resetting the system.12890
Suggestion: lowmem can be added.
B. The native system registers an observer for the/data/tombstones directory.TAG = SYSTEM_TOMBSTONE
If the system throws a tombstone and does not cause shutdown, the error will be added to DropBox. This is to add information to DropBox through the DropBoxManager. addText () interface.

sTombstoneObserver = new FileObserver(TOMBSTONE_DIR.getPath(), FileObserver.CLOSE_WRITE) { @Override public void onEvent(int event, String path) { try { File file = new File(TOMBSTONE_DIR, path); if (file.isFile()) { addFileToDropBox(db, prefs, headers, file.getPath(), LOG_SIZE, "SYSTEM_TOMBSTONE"); } } catch (IOException e) { Slog.e(TAG, "Can't log tombstone", e); } } };
This logic is in the frameworks/base/core/java/com/android/server/BootReceiver. java file.
Suggestion: you can add a point to intercept more logs.
C. Logic for capturing exception information after startup in frameworks/base/core/java/com/android/server/BootReceiver. javaAfter the machine is restarted (Kernel and Flyme): TAG = SYSTEM_BOOTFlyme restart: TAG = SYSTEM_RESTART start from Recovery start: TAG = SYSTEM_RECOVERY_LOG boot scan/data/tombstones Directory: TAG = SYSTEM_TOMBSTONE
After the boot, the native logic has captured some information, but not many details.

Suggestion: During SYSTEM_BOOT, you do not need to capture any logs because the system restarts and all information is rushed out. During SYSTEM_RESTART, you can try to capture Android and kernel logs, which may capture useful information, however, the exception log may have been washed out because it has been starting for a while. During SYSTEM_RECOVERY_LOG, this is done by native; Guoqifa@meizu.com

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.