最終更新:2017-08-07 (月) 15:30:11 (744d)  

logcat はてなブックマークを見る
Top / logcat

a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class.

http://developer.android.com/tools/help/logcat.html

表示

文字数が足りない場合

項目

  • date time PID-TID/package priority/tag: message
    datePIDTIDLevelTAGMessage
    04-04 17:37:34.33740364099DBluetoothAdapter?: STATE_ON

usage

  • Usage: 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 <count>, default 4
      -v <format>     Sets the log print format, where <format> 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)
      -t <count>      print only the most recent <count> lines (implies -d)
      -g              get the size of the log's ring buffer and exit
      -b <buffer>     Request alternate ring buffer, 'main', 'system', 'radio'
                      or 'events'. Multiple -b parameters are allowed and the
                      results are interleaved. The default is -b main -b system.
      -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"

Frameworkのログを表示

  • adb shell setprop log.tag.<YOUR_LOG_TAG> <LEVEL>
    adb shell setprop log.tag.AccountManagerService VERBOSE

AndroidManifest.xml

出力

Java

  • android.util.Log
    • Log.v(String, String) (verbose)
    • Log.d(String, String) (debug)
    • Log.i?(String, String) (information)
    • Log.w?(String, String) (warning)
    • Log.e(String, String) (error)

C++

Android 4.0

Android 4.1

  • ALOG
  • ALOGV (verbose)
  • ALOGD (debug)
  • ALOGI? (information)
  • ALOGW? (warning)
  • ALOGE? (error)

関連