ADB (8)-View Log

Source: Internet
Author: User

The logs of the Android system are divided into two parts, and the underlying Linux kernel logs output to the/proc/kmsg,android log output to/dev/log.

Android logs

Command format:

[adb] logcat [

Common usage is listed below:

Filter logs by level

The logs for Android are divided into several levels:

    • V--verbose (lowest, most output)
    • D--debug
    • I--info
    • W--warning
    • E--error
    • F--fatal
    • S--silent (highest, no output)

Filtering logs at a certain level will output logs of that level and above.

For example, command:

adb logcat *:W

The Warning, Error, Fatal, and Silent logs are output.

Filter logs by Tag and level

For example, command:

adb logcat ActivityManager:I MyApp:D *:S

Indicates the output tag ActivityManager of the above level of the log, output the MyApp Debug level of the tag log, and other tags of the Silent level log (that is, blocking other tag logs).

Log format

You can adb logcat -v  specify the log output format with options.

The logs are supported by the following types :

  • Brief

    The default format. The format is:

    Example:

    D/HeadsetStateMachine( 1785): Disconnected process message: 10, size: 0
  • Process

    The format is:

    Example:

    D( 1785) Disconnected process message: 10, size: 0  (HeadsetStateMachine)
  • Tag

    The format is:

    Example:

    D/HeadsetStateMachine: Disconnected process message: 10, size: 0
  • Raw

    The format is:

    Example:

    Disconnected process message: 10, size: 0
  • Time

    The format is:

    Example:

    08-28 22:39:39.974 D/HeadsetStateMachine( 1785): Disconnected process message: 10, size: 0
  • ThreadTime

    The format is:

        

    Example:

    08-28 22:39:39.974  1785  1832 D HeadsetStateMachine: Disconnected process message: 10, size: 0
  • Long

    The format is:

    [  : / ]

    Example:

    [ 08-28 22:39:39.974  1785: 1832 D/HeadsetStateMachine ]Disconnected process message: 10, size: 0

The specified format can be used in conjunction with the above filtering. Like what:

adb logcat -v long ActivityManager:I *:S
Empty log
adb logcat -c
Kernel log

Command:

adb shell dmesg

Output Example:

<6>[14201.684016] PM: noirq resume of devices complete after 0.982 msecs<6>[14201.685525] PM: early resume of devices complete after 0.838 msecs<6>[14201.753642] PM: resume of devices complete after 68.106 msecs<4>[14201.755954] Restarting tasks ... done.<6>[14201.771229] PM: suspend exit 2016-08-28 13:31:32.679217193 UTC<6>[14201.872373] PM: suspend entry 2016-08-28 13:31:32.780363596 UTC<6>[14201.872498] PM: Syncing filesystems ... done.

In parentheses, the [14201.684016] time, in seconds, after the kernel starts to start.

Through the kernel log we can do something, such as measuring the kernel boot time, in the kernel log after the system started to find the Freeing init memory line in front of the time is.

ADB (8)-View Log

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.