Interpreting the implementation of the Android LOG Mechanism: (1) implementation architecture of LOG

Source: Internet
Author: User

 

Android provides a user-level lightweight LOG Mechanism. Its implementation runs through Java, JNI, local c/c ++ implementation, Linux kernel driver, and Other Android layers. It is simple and clear enough, it is a pretty good case. This series of articles explains the internal implementation mechanism of the LOG mechanism. This is the first article in the series to explain the implementation architecture of the LOG mechanism.

 

 

 

LOG running environment

 

It is the Android Debug environment provided on the official website of Android.

 

 

The LOG Mechanism of Android is also running in this environment. We focus on the running part of Emulator and Device. App VMs generates LOG information and interacts with ADB Device Daemon to output this information, the ADB Device Daemon interacts with the ADB Host Daemon running on the PC through a USB (Device) or a local connection (Emulator) through the corresponding protocol, it is presented to users through debugging tools on the PC. The interaction between JDWP Debugger, DDMS, ADB Host Daemon, and ADB Device Daemon is not covered in this article. The content discussed in this article runs on Emulator/Device to generate LOG information and output it through the program LogCat.

 

 

 

Implementation architecture of LOG

 

Shows the implementation architecture of LOG in Android. This is basically the classic architecture of a module in Android that implements various layers.

 

 

Android applications operate through the mechanism provided by the Framework; Java requires local c/c ++ to provide services, implemented through JNI; JNI calls the underlying library; the library function operates the device by operating the mapped device file, and the Driver in LINUX kernel performs the corresponding operations. Besides Java and JNI, the c/c ++ program of the user domain on LINUX can also be completed by operating the device file.

 

 

 

 

Android LOG is also implemented in this way and will be described separately in this series of articles. The application uses android. util. various static methods in Log, output LOG information [detailed description in Series 2]; Log calls the implementation of c/c ++ through the JNI interface, while locally implemented write LOG, that is, write information to the device file [Detailed description of the three articles in series]; the device file is a lightweight driver logger of LINUX written by Android for the LOG mechanism [details in series 4]; the LOG information can be displayed by the LogCat program running on the Emulator/Device [details of the fifth series]. In addition, the local implementation library of Android can also use the existing mechanism, directly output LOG in the c/c ++ space [details in Series 6].

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.