From fe57f3897ebe37ccfd6e6448b70dfaef3a95cc7a Mon Sep 17 00:00:00 2001 From: Dirk Dougherty Date: Thu, 28 Jun 2012 15:35:12 -0700 Subject: Doc change: fix broken links to logcat info. Change-Id: I006ade072232734cb049e5268bbc4d7a1efb5c55 --- docs/html/tools/help/adb.jd | 183 ++--------------------------------------- docs/html/tools/help/logcat.jd | 15 ++-- 2 files changed, 15 insertions(+), 183 deletions(-) (limited to 'docs/html/tools') diff --git a/docs/html/tools/help/adb.jd b/docs/html/tools/help/adb.jd index ddebed605b89..4e75f2e1dcc8 100644 --- a/docs/html/tools/help/adb.jd +++ b/docs/html/tools/help/adb.jd @@ -23,7 +23,7 @@ parent.link=index.html
  • Copying Files to or from an Emulator/Device Instance
  • Listing of adb Commands
  • Issuing Shell Commands
  • -
  • Enabling logcat Logging
  • +
  • Enabling Logcat Logging
  • Stopping the adb Server
  • @@ -464,23 +464,22 @@ application and send 500 pseudo-random events to it.

    - + + + + + +

    Enabling logcat Logging

    The Android logging system provides a mechanism for collecting and viewing system debug output. Logs from various applications and portions of the system are collected in a series of circular buffers, which then can be viewed and filtered by the logcat command.

    - - -

    Using logcat Commands

    -

    You can use the logcat command to view and follow the contents of the system's log buffers. The general usage is:

    [adb] logcat [<option>] ... [<filter-spec>] ...
    -

    The sections below explain filter specifications and the command options. See Listing of logcat Command Options for a summary of options.

    -

    You can use the logcat command from your development computer or from a remote adb shell in an emulator/device instance. To view log output in your development computer, you use

    $ adb logcat
    @@ -489,174 +488,8 @@ application and send 500 pseudo-random events to it.

    # logcat
    - - -

    Filtering Log Output

    - -

    Every Android log message has a tag and a priority associated with it.

    - - - -

    You can obtain a list of tags used in the system, together with priorities, by running logcat and observing the first two columns -of each message, given as <priority>/<tag>.

    - -

    Here's an example of logcat output that shows that the message relates to priority level "I" and tag "ActivityManager":

    - -
    I/ActivityManager(  585): Starting activity: Intent { action=android.intent.action...}
    - -

    To reduce the log output to a manageable level, you can restrict log output using filter expressions. Filter expressions let you indicate to the system the tags-priority combinations that you are interested in — the system suppresses other messages for the specified tags.

    - -

    A filter expression follows this format tag:priority ..., where tag indicates the tag of interest and priority indicates the minimum level of priority to report for that tag. Messages for that tag at or above the specified priority are written to the log. You can supply any number of tag:priority specifications in a single filter expression. The series of specifications is whitespace-delimited. The default output is to show all log messages with the Info priority (*:I).

    +

    See Reading and Writing Logs for complete information about logcat commend options and filter specifications.

    -

    Here's an example of a filter expression that suppresses all log messages except those with the tag "ActivityManager", at priority "Info" or above, and all log messages with tag "MyApp", with priority "Debug" or above:

    - -
    adb logcat ActivityManager:I MyApp:D *:S
    - -

    The final element in the above expression, *:S, sets the priority level for all tags to "silent", thus ensuring only log messages with "View" and "MyApp" are displayed. Using *:S is an excellent way to ensure that log output is restricted to the filters that you have explicitly specified — it lets your filters serve as a "whitelist" for log output.

    - -

    The following filter expression displays all log messages with priority level "warning" and higher, on all tags:

    - -
    adb logcat *:W
    - -

    If you're running logcat from your development computer (versus running it on a remote adb shell), you can also set a default filter expression by exporting a value for the environment variable ANDROID_LOG_TAGS:

    - -
    export ANDROID_LOG_TAGS="ActivityManager:I MyApp:D *:S"
    - -

    Note that ANDROID_LOG_TAGS filter is not exported to the emulator/device instance, if you are running logcat from a remote shell or using adb shell logcat.

    - - - - -

    Controlling Log Output Format

    - -

    Log messages contain a number of metadata fields, in addition to the tag and priority. You can modify the output format for messages so that they display a specific metadata field. To do so, you use the -v option and specify one of the supported output formats listed below.

    - - - -

    When starting logcat, you can specify the output format you want by using the -v option:

    - -
    [adb] logcat [-v <format>]
    - -

    Here's an example that shows how to generate messages in thread output format:

    - -
    adb logcat -v thread
    - -

    Note that you can only specify one output format with the -v option.

    - - - -

    Viewing Alternative Log Buffers

    - -

    The Android logging system keeps multiple circular buffers for log messages, and not all of the log messages are sent to the default circular buffer. To see additional log messages, you can start logcat with the -b option, to request viewing of an alternate circular buffer. You can view any of these alternate buffers:

    - - - -

    The usage of the -b option is:

    - -
    [adb] logcat [-b <buffer>]
    - -

    Here's an example of how to view a log buffer containing radio and telephony messages:

    - -
    adb logcat -b radio
    - - - -

    Viewing stdout and stderr

    - -

    By default, the Android system sends stdout and stderr (System.out and System.err) output to /dev/null. In -processes that run the Dalvik VM, you can have the system write a copy of the output to the log file. In this case, the system writes the messages to the log using the log tags stdout and stderr, both with priority I.

    - -

    To route the output in this way, you stop a running emulator/device instance and then use the shell command setprop to enable the redirection of output. Here's how you do it:

    - -
    $ adb shell stop
    -$ adb shell setprop log.redirect-stdio true
    -$ adb shell start
    - -

    The system retains this setting until you terminate the emulator/device instance. To use the setting as a default on the emulator/device instance, you can add an entry to /data/local.prop -on the device.

    - - - -

    Listing of logcat Command Options

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    OptionDescription
    -b <buffer>Loads an alternate log buffer for viewing, such as event or radio. The main buffer is used by default. See Viewing Alternative Log Buffers.
    -cClears (flushes) the entire log and exits.
    -dDumps the log to the screen and exits.
    -f <filename>Writes log message output to <filename>. The default is stdout.
    -gPrints the size of the specified log buffer and exits.
    -n <count>Sets the maximum number of rotated logs to <count>. The default value is 4. Requires the -r option.
    -r <kbytes>Rotates the log file every <kbytes> of output. The default value is 16. Requires the -f option.
    -sSets the default filter spec to silent.
    -v <format>Sets the output format for log messages. The default is brief format. For a list of supported formats, see Controlling Log Output Format.
    diff --git a/docs/html/tools/help/logcat.jd b/docs/html/tools/help/logcat.jd index d504b22c7fde..ede1905f4a76 100644 --- a/docs/html/tools/help/logcat.jd +++ b/docs/html/tools/help/logcat.jd @@ -8,12 +8,11 @@ parent.link=index.html circular buffers, which then can be viewed and filtered by the logcat command. You can use logcat from an ADB shell to view the log messages.

    -

    This document is a reference to the available command line options. For more information on logcat, see - Reading and Writing Logs. -For more - information on accessing logcat from DDMS, instead of the command line, see the documentation for the - Dalvik Debug Monitor Server. -

    +

    For complete information about logcat options and filtering specifications, see + Reading and Writing Logs.

    + +

    For more information on accessing logcat from DDMS, instead of the command line, see + Using DDMS.

    Syntax

    @@ -48,7 +47,7 @@ $ adb shell
     
           Loads an alternate log buffer for viewing, such as event or
           radio. The main buffer is used by default. See Viewing Alternative Log Buffers.
    +      "{@docRoot}tools/debugging/debugging-log.html#alternativeBuffers">Viewing Alternative Log Buffers.
         
     
         
    @@ -100,7 +99,7 @@ $ adb shell
           -v <format>
     
           Sets the output format for log messages. The default is brief format. For a
    -      list of supported formats, see Controlling Log Output
    +      list of supported formats, see Controlling Log Output
           Format.
         
       
    -- 
    cgit v1.2.3-59-g8ed1b