page.title=logcat Monitor parent.title=Android Monitor parent.link=android-monitor.html page.tags=monitor @jd:body
The Android logging system provides a mechanism for collecting and viewing system debug output. logcat Monitor displays messages that you added to your app by using the Log class, as well as system messages, such as stack traces when the emulator throws an error or a garbage collection occurs. The monitor displays messages in real time and also keeps a history so you can view older messages.
To display just the information of interest, you can create filters, modify how much information is displayed in messages, set priority levels, display messages produced by app code only, and search the log. By default, logcat Monitor shows the log output related to the running application only.
You can traverse the stack trace when your app throws an exception, as well as view the associated code. This feature can help you fix exceptions and improve app operation.
Every Android log message has a tag and a priority associated with it. The tag of a system
log message
is a short string indicating the system component from which the message originates (for example,
ActivityManager
). A user-defined tag can be any string that you find helpful, such
as the name of the current class (the recommended tag). You define it in a Log
method call, for example:
Log.d(tag, message);
The priority is one of the following values:
The log message format is:
date time PID-TID/package priority/tag: message
For example, the following log message has a priority of V
and a tag of
AuthZen
:
12-10 13:02:50.071 1901-4229/com.google.android.gms V/AuthZen: Handling delegate intent.
PID stands for process identifier and TID is thread identifier; they can be the same if there’s only one thread.
Follow these steps:
By default, the logcat Monitor displays messages for the app running on the device or emulator:
To change this default, see Filtering logcat Messages.
You can control how many messages appear in logcat Monitor by setting the log level. You can display all messages, or just the messages indicating the most severe conditions.
Remember that logcat Monitor continues to collect all messages regardless of the log level setting. The setting just determines what logcat Monitor displays.
Follow this step:
You can search the messages currently displayed in logcat Monitor. Follow these steps:
The logcat Monitor display changes accordingly.
One way to reduce the log output to a manageable level is to restrict it by using a filter.
Note: The filter applies to your full logcat history, not just those messages currently displayed in logcat Monitor. Make sure your other display options are set appropriately so you can see the filter output you want to examine.
To define and apply a filter, follow these steps:
After you define filters, you can also select them in the menu. To remove them from the menu, delete them.
To remove a filter, select it in the left pane and click -.
You can customize the header display to show just the information you’re interested in:
For more information about message elements, see logcat Message Format.
When the app throws an exception, the message includes a stack trace of method calls. logcat Monitor lets you quickly locate stack traces in the log and view the associated code in the Code Editor. If needed (and possible), the decompiler derives source code that you can view.
Clicking a particular message stops the display of messages. You can quickly move to the end of the log to see the real-time message flow.
Follow these steps:
To clear (flush) the entire log, follow this step:
If there is a problem and the log is no longer progressing, you can restart the log. Follow this step: