blob: 1577604ae61b20b0467ad5ea329ddbef859bb36d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
page.title=logcat
@jd:body
<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>This document is a reference to the available command line options. For more information on <code>logcat</code>, see
<a href="{@docRoot}guide/developing/debugging/debugging-log.html">Reading and Writing Log Messages</a>. For more
information on accessing <code>logcat</code> from DDMS, instead of the command line, see the documentation for the
<a href="{@docRoot}guide/developing/debugging/ddms.html">Dalvik Debug Monitor Server</a>.
</p>
<h3>Syntax</h3>
<pre>
[adb] logcat [<option>] ... [<filter-spec>] ...
</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 <buffer></code></td>
<td>Loads an alternate log buffer for viewing, such as <code>event</code> or
<code>radio</code>. The <code>main</code> buffer is used by default. See <a href=
"#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 <filename></code></td>
<td>Writes log message output to <code><filename></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 <count></code></td>
<td>Sets the maximum number of rotated logs to <code><count></code>. The default value
is 4. Requires the <code>-r</code> option.</td>
</tr>
<tr>
<td><code>-r <kbytes></code></td>
<td>Rotates the log file every <code><kbytes></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 <format></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="#outputformat">Controlling Log Output
Format</a>.</td>
</tr>
</table>
|