首页 > 移动平台 > 详细

android Tips

时间:2015-12-23 09:20:29      阅读:201      评论:0      收藏:0      [点我收藏+]

本文记录下android学习中的一些知识点

  logcat:

技术分享
// java层的logcat我们不谈,看native层:/system/core/include/log/log.h以ALOGV()为例,
/*
50 * Normally we strip ALOGV (VERBOSE messages) from release builds.
51 * You can modify this (for example with "#define LOG_NDEBUG 0"
52 * at the top of your source file) to change that behavior.
53 */
#ifndef LOG_NDEBUG
#ifdef NDEBUG
#define LOG_NDEBUG 1
#else
#define LOG_NDEBUG 0
#endif
#endif

#ifndef ALOGV
#if LOG_NDEBUG
#define ALOGV(...)   ((void)0)
#else
#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
#endif
#endif
// 需设置#define LOG_NDEBUG 0才能输出系统的ALOGV()信息
#define ALOG(priority, tag, ...) \
    LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
#endif
/*
 * Log macro that allows you to specify a number for the priority.
 */
#ifndef LOG_PRI
#define LOG_PRI(priority, tag, ...) \
    android_printLog(priority, tag, __VA_ARGS__)
#endif
// 你可以看看从ALOGV一直到__android_log_print,
// 而__android_log_print就关联的日志的写文件操作,这里我们先不提
#define android_printLog(prio, tag, fmt...) \
    __android_log_print(prio, tag, fmt)
    
// 接下来我们看看系统中的logcat文件 
$ adb shell dmesg > dmesg.txt   linux内核启动log,init进程log
$ adb logcat -d -v time -b "main"   >  main.txt  Zygote进程log
$ adb logcat -d -v time -b "system" >  system.txt SystemServer进程的log
$ adb logcat -d -v time -b "events" >   events .txt 
// 详情看 Android内核开发:学会分析系统启动log http://ticktick.blog.51cto.com/823160/1662911
View Code

 

android Tips

原文:http://www.cnblogs.com/vendanner/p/5068835.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!