ITEEDU

控制日志输出格式

日志信息包括了许多元数据域包括标签和优先级。可以修改日志的输出格式,所以可以显示出特定的元数据域。可以通过 -v选项得到格式化输出日志的相关信息.

  • brief — Display priority/tag and PID of originating process (the default format).
  • process — Display PID only.
  • tag — Display the priority/tag only.
  • thread — Display process:thread and priority/tag only.
  • raw — Display the raw log message, with no other metadata fields.
  • time — Display the date, invocation time, priority/tag, and PID of the originating process.
  • long — Display all metadata fields and separate messages with a blank lines.

当启动了logcat,你可以通过-v 选项来指定输出格式:

[adb] logcat [-v <format>]

下面是用 thread来产生的日志格式:

adb logcat -v thread

需要注意的是你只能-v 选项来规定输出格式 option.