分享

adb logcat 基本用法

 quasiceo 2014-11-19
分类: Android入门 android 调试方法 2012-09-28 14:58 8077人阅读 评论(1) 收藏 举报

入门android ,至少需要了解 adb 吧,那么打 log 也是必不可少的了。

下面简单介绍一下 adb logcat 基本用法:

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"

 

实例:adb logcat -v time -s videocamera

意思是说,会打印出 log 信息中时间,以及包含关键字 "videocamera" 的所有 log

C:\Users\Administrator>adb logcat -v time -s videocamera fulin
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
07-01 08:43:57.037 V/videocamera( 2329): VideoCamera onCreate!
07-01 08:43:57.039 I/videocamera( 2329): getExternalSdState() : removed
07-01 08:43:57.040 I/videocamera( 2329): getExternalState() : mounted
07-01 08:43:57.040 I/videocamera( 2329): Sdcard is exists ? false
07-01 08:43:57.157 V/videocamera( 2329): fulin onCreate Storage.getAvailableSpace() 1335459840
07-01 08:43:57.159 V/videocamera( 2329): fulin initThumbnailButton
07-01 08:43:57.170 D/videocamera( 2329): Thumbnail.getLastThumbnail >>>
07-01 08:43:57.204 E/videocamera( 2329): --------------readVideoPreferences---------------minutes = 600
07-01 08:43:57.205 E/videocamera( 2329): --------------readVideoPreferences----------quality6=10
07-01 08:43:57.207 E/videocamera( 2329): -----------------readVideoPreferences---------mCameraId=0
07-01 08:43:57.208 E/videocamera( 2329): -----------------readVideoPreferences---------quality7=10
07-01 08:43:57.209 V/videocamera( 2329): mDesiredPreviewWidth=640. mDesiredPreviewHeight=480
07-01 08:43:57.234 V/videocamera( 2329): startPreview
07-01 08:43:57.240 V/videocamera( 2329): videocamera--mParameters.setFocusMode(mFocusManager.getFocusMode())
07-01 08:43:57.265 D/videocamera( 2329): Thumbnail.getLastThumbnail <<< is null:false
07-01 08:43:57.269 V/videocamera( 2329): Video snapshot size is 3264x2448
07-01 08:43:57.376 D/videocamera( 2329): SupportedPreviewSizes : 176x144
07-01 08:43:57.376 D/videocamera( 2329): SupportedPreviewSizes : 320x240
07-01 08:43:57.376 D/videocamera( 2329): SupportedPreviewSizes : 352x288
07-01 08:43:57.376 D/videocamera( 2329): SupportedPreviewSizes : 480x368
07-01 08:43:57.376 D/videocamera( 2329): SupportedPreviewSizes : 640x480
07-01 08:43:57.376 D/videocamera( 2329): SupportedPreviewSizes : 720x480
07-01 08:43:57.376 D/videocamera( 2329): SupportedPreviewSizes : 800x600
07-01 08:43:57.376 D/videocamera( 2329): SupportedPreviewSizes : 864x480
07-01 08:43:57.376 D/videocamera( 2329): SupportedPreviewSizes : 1280x720
07-01 08:43:57.422 V/videocamera( 2329): updateSceneOnScreenIndicator isVisible falsemSceneIndicatorandroid.widget.ImageView@41acd0e0

……

主题推荐
filter snapshot thread printf 实例
猜你在找
ANDROID对SDCARD权限的设置
Android Service 详解四:开始停止service
Android如何完全调试framework层代码
android手机安装软件后/data/app目录的变化
boot loader,Linux 内核,文件系统之间的关系
Android 录音(MediaRecorder)与播放(MediaPlayer)
linux驱动学习之ioctl接口
linux驱动面试题目汇总
Android入门:Intent入门(2)
Android提高篇之自定义dialog实现processDialog“正在加载”效果、使用Animation实现图片旋转
查看评论
1楼 fulinwsuafcie 2014-02-19 15:49发表 [回复]
adb logcat | grep -i "mirror_front_camera" --color=auto
可以在log中将关键词 mirror_front_camera 高亮显示出来。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多