安卓抛异常查看Log堆栈信息

来源:互联网 发布:快速除法的算法实现 编辑:程序博客网 时间:2024/05/29 10:43

代码中:

RuntimeException re = new RuntimeException();

re.fillInStackTrace();

android.util.Log.i("20150808", "RuntimeException", re);


adb shell中:

adb logcat | grep "20150808"



C语言Log
#include <utils/Log.h>    // 日志头文件
 ALOGV("create");  // 打印一般的LOG
 ALOGV("storeMetaDataInBuffers: %s",enabled? "true": "false"); // 带占位符的Log
 ALOGE("camera remote is a NULL pointer");// 打印异常的LOG
 ALOGW("An error occurred while connecting to camera: %d", cameraId); // 警告的Log
 ALOGD("An error occurred while connecting to camera: %d", cameraId); // 警告的Log
 ALOGD_IF(bufferProducer == 0, "app passed NULL surface");// 有条件输出的Log



C语言堆栈Log
#include <utils/CallStack.h>
CallStack debug_lock = CallStack("debug_lock ",1); 


adb logcat | findstr "debug_lock"

0 0