[关闭]
@act262 2017-08-09T14:03:16.000000Z 字数 3141 阅读 1417

adb shell logcat 命令

adb_shell


adb shell logcat命令映射为adb logcat
查看帮助命令adb logcat --help


  1. logcat -f out.log
  1. adb logcat -v time >> d:\1.txt
  1. adb logcat -v brief
  2. adb logcat -v time
  1. # 输出所有Error的log,没有指定Tag
  2. adb logcat *:E
  3. # 输出System.out的log
  4. adb logcat System.out
  5. # 输出指定包名的log
  6. adb logcat --pid=xx
  7. # 输出指定包名的log,用于低版本adb命令,需要手动匹配出来
  8. adb logcat | grep "xxx"

Help

  1. C:\Users\act.zhang>adb logcat --help
  2. Usage: logcat [options] [filterspecs]
  3. options include:
  4. -s Set default filter to silent.
  5. Like specifying filterspec '*:S'
  6. -f <filename> Log to file. Default is stdout
  7. --file=<filename>
  8. -r <kbytes> Rotate log every kbytes. Requires -f
  9. --rotate-kbytes=<kbytes>
  10. -n <count> Sets max number of rotated logs to <count>, default 4
  11. --rotate-count=<count>
  12. -v <format> Sets the log print format, where <format> is:
  13. --format=<format>
  14. brief color epoch long monotonic printable process raw
  15. tag thread threadtime time uid usec UTC year zone
  16. -D print dividers between each log buffer
  17. --dividers
  18. -c clear (flush) the entire log and exit
  19. --clear
  20. -d dump the log and then exit (don't block)
  21. -e <expr> only print lines where the log message matches <expr>
  22. --regex <expr> where <expr> is a regular expression
  23. -m <count> quit after printing <count> lines. This is meant to be
  24. --max-count=<count> paired with --regex, but will work on its own.
  25. --print paired with --regex and --max-count to let content bypass
  26. regex filter but still stop at number of matches.
  27. -t <count> print only the most recent <count> lines (implies -d)
  28. -t '<time>' print most recent lines since specified time (implies -d)
  29. -T <count> print only the most recent <count> lines (does not imply -d)
  30. -T '<time>' print most recent lines since specified time (not imply -d)
  31. count is pure numerical, time is 'MM-DD hh:mm:ss.mmm...'
  32. 'YYYY-MM-DD hh:mm:ss.mmm...' or 'sssss.mmm...' format
  33. -g get the size of the log's ring buffer and exit
  34. --buffer-size
  35. -G <size> set size of log ring buffer, may suffix with K or M.
  36. --buffer-size=<size>
  37. -L dump logs from prior to last reboot
  38. --last
  39. -b <buffer> Request alternate ring buffer, 'main', 'system', 'radio',
  40. --buffer=<buffer> 'events', 'crash', 'default' or 'all'. Multiple -b
  41. parameters are allowed and results are interleaved. The
  42. default is -b main -b system -b crash.
  43. -B output the log in binary.
  44. --binary
  45. -S output statistics.
  46. --statistics
  47. -p print prune white and ~black list. Service is specified as
  48. --prune UID, UID/PID or /PID. Weighed for quicker pruning if prefix
  49. with ~, otherwise weighed for longevity if unadorned. All
  50. other pruning activity is oldest first. Special case ~!
  51. represents an automatic quicker pruning for the noisiest
  52. UID as determined by the current statistics.
  53. -P '<list> ...' set prune white and ~black list, using same format as
  54. --prune='<list> ...' printed above. Must be quoted.
  55. --pid=<pid> Only prints logs from the given pid.
  56. --wrap Sleep for 2 hours or when buffer about to wrap whichever
  57. comes first. Improves efficiency of polling by providing
  58. an about-to-wrap wakeup.
  59. filterspecs are a series of
  60. <tag>[:priority]
  61. where <tag> is a log component tag (or * for all) and priority is:
  62. V Verbose (default for <tag>)
  63. D Debug (default for '*')
  64. I Info
  65. W Warn
  66. E Error
  67. F Fatal
  68. S Silent (suppress all output)
  69. '*' by itself means '*:D' and <tag> by itself means <tag>:V.
  70. If no '*' filterspec or -s on command line, all filter defaults to '*:V'.
  71. eg: '*:S <tag>' prints only <tag>, '<tag>:S' suppresses all <tag> log messages.
  72. If not specified on the command line, filterspec is set from ANDROID_LOG_TAGS.
  73. If not specified with -v on command line, format is set from ANDROID_PRINTF_LOG
  74. or defaults to "threadtime"
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注