Tips for Android developer: Logcat

As Android developer, Locat is a useful tool for debugging, and you can use it through Eclipse or by “logcat” command in the “adb shell”. The usage of logcat is:

logcat [options] [filterspecs]

options include:
-s Set default filter to silent.
Like specifying filterspec ‘*:s’
-f <filename> Log to file. Default to stdout
-r [<kbytes>] Rotate log every kbytes. (16 if unspecified). Requires -f
-n <count> Sets max number of rotated logs to , default 4
-v <format> Sets the log print format, where
is one of:

brief process tag thread raw time threadtime long

-c clear (flush) the entire log and exit
-d dump the log and then exit (don’t block)
-g get the size of the log’s ring buffer and exit
-b <buffer> request alternate ring buffer
(‘main’ (default), ‘radio’, ‘events’)
-B output the log in binary
filterspecs are a series of
<tag>[:priority]

where <tag> is a log component tag (or * for all) and priority is:
V Verbose
D Debug
I Info
W Warn
E Error
F Fatal
S Silent (supress all output)

‘*’ means ‘*:d’ and <tag> by itself means <tag>:v

If not specified on the commandline, filterspec is set from ANDROID_LOG_TAGS.
If no filterspec is found, filter defaults to ‘*:I’

If not specified with -v, format is set from ANDROID_PRINTF_LOG
or defaults to “brief”

Related Android Apps:

  1. Five Android Logcat Related Open Source Apps for Developers
  2. Tips for Android developer: “Conversion to Dalvik format failed: Unable to execute dex: null”
  3. Tips for Android developer: Android emulator appearance standard
  4. Tips for Android developer: Project contains errors
  5. Tips for Android developer: SQLite Database
  6. Tips for Android developer: An SDK Target must be specified
  7. Tips for Android developer: failed to copy file to system
  8. Tips for Android developer: install & uninstall Android applications
  9. Tips for Android developer: Android source code
  10. Tips for Android developer: Android SDK tools PATH setting