Cheryl Potter 9f1fd9a2dc docs: new Android Monitor doc
b/24142260

Change-Id: I69dc6b40ddf7689ff5560bea9fe103816832872a
2015-12-18 14:40:36 -08:00

116 lines
3.3 KiB
Plaintext

page.title=logcat
parent.title=Tools
parent.link=index.html
@jd:body
<div id="qv-wrapper">
<div id="qv">
<h2>See also</h2>
<ol>
<li><a href="{@docRoot}tools/help/android-monitor.html">Android Monitor</a></li>
</ol>
</div>
</div>
<p>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 <code>logcat</code> command. You can use
<code>logcat</code> from an ADB shell to view the log messages.</p>
<p>For complete information about logcat options and filtering specifications, see
<a href="{@docRoot}tools/debugging/debugging-log.html">Reading and Writing Logs</a>.</p>
<p>For more information on accessing <code>logcat</code> from DDMS, instead of the command line, see
<a href="{@docRoot}tools/debugging/ddms.html">Using DDMS</a>. </p>
<h3>Syntax</h3>
<pre>
[adb] logcat [&lt;option&gt;] ... [&lt;filter-spec&gt;] ...
</pre>
<p>You can run <code>logcat</code> as an adb command or directly in a shell prompt
of your emulator or connected device. To view log output using adb, navigate to your SDK
<code>platform-tools/</code> directory and execute:</p>
<pre>
$ adb logcat
</pre>
<p>You can create a shell connection to a device and execute:</p>
<pre>
$ adb shell
# logcat
</pre>
<h3>Options</h3>
<p>The following table describes the command line options of <code>logcat</code>.</p>
<table>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
<tr>
<td><code>-b&nbsp;&lt;buffer&gt;</code></td>
<td>Loads an alternate log buffer for viewing, such as <code>events</code> or
<code>radio</code>. The <code>main</code> buffer is used by default. See <a href=
"{@docRoot}tools/debugging/debugging-log.html#alternativeBuffers">Viewing Alternative Log Buffers</a>.</td>
</tr>
<tr>
<td><code>-c</code></td>
<td>Clears (flushes) the entire log and exits.</td>
</tr>
<tr>
<td><code>-d</code></td>
<td>Dumps the log to the screen and exits.</td>
</tr>
<tr>
<td><code>-f&nbsp;&lt;filename&gt;</code></td>
<td>Writes log message output to <code>&lt;filename&gt;</code>. The default is
<code>stdout</code>.</td>
</tr>
<tr>
<td><code>-g</code></td>
<td>Prints the size of the specified log buffer and exits.</td>
</tr>
<tr>
<td><code>-n&nbsp;&lt;count&gt;</code></td>
<td>Sets the maximum number of rotated logs to <code>&lt;count&gt;</code>. The default value
is 4. Requires the <code>-r</code> option.</td>
</tr>
<tr>
<td><code>-r&nbsp;&lt;kbytes&gt;</code></td>
<td>Rotates the log file every <code>&lt;kbytes&gt;</code> of output. The default value is
16. Requires the <code>-f</code> option.</td>
</tr>
<tr>
<td><code>-s</code></td>
<td>Sets the default filter spec to silent.</td>
</tr>
<tr>
<td><code>-v&nbsp;&lt;format&gt;</code></td>
<td>Sets the output format for log messages. The default is <code>brief</code> format. For a
list of supported formats, see <a href="{@docRoot}tools/debugging/debugging-log.html#outputFormat">Controlling Log Output
Format</a>.</td>
</tr>
</table>