summaryrefslogtreecommitdiffstats
path: root/docs/html/tools/help/logcat.jd
blob: ede1905f4a766cfbf7dae17b192e73eed317e446 (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
105
page.title=logcat
parent.title=Tools
parent.link=index.html
@jd:body

  <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>event</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>