重定向android log
android里面的log输出以往都是在eclipse里面看,如果通过USB连接电脑,可以输出到PC上。

try {
//adb logcat -v threadtime > logcat.txt
String fileName = "logcat_" + System.currentTimeMillis() + ".txt";
File outputFile = new File(Environment.getExternalStorageDirectory(), fileName);
@SuppressWarnings("unused")
Process process = Runtime.getRuntime().exec(
"logcat -v threadtime -f" + outputFile.getAbsolutePath());
} catch (IOException e) {
}
bat:
adb logcat -v threadtime > logcat.txt
参考文档:
Reading and Writing Logs
http://developer.android.com/tools/debugging/debugging-log.html
Android Debug Bridge, Part 1: How to Capture Logcat Files Using ADB
http://university.utest.com/android-debug-bridge-part-1-how-to-capture-logcat-files-using-adb/
write to file on sd card
http://stackoverflow.com/questions/6175002/write-android-logcat-data-to-a-file
重定向android log的更多相关文章
- android log机制——输出log【转】
转自:http://blog.csdn.net/tdstds/article/details/19084327 目录(?)[-] 在android Java code中输出log Logprintln ...
- android Log.isLoggable步骤的使用
原文地址: http://www.cnblogs.com/maxinliang/p/4024442.html android Log.isLoggable方法的使用 android 动态控制logca ...
- 转:Android Log
在调试代码的时候我们需要查看调试信息,那我们就需要用Android Log类. android.util.Log常用的方法有以下5个:Log.v() Log.d() Log.i() Log.w() 以 ...
- 在非NDK编译条件下使用Android Log函数
解决的需求 有些时候不能在NDK环境编译,或者使用NDK编译会颇费周折,然后又想使用Android系统自带的Log类方法,那么我们就可以使用dlopen来实现我们的目的.比如在OpenCV中添加And ...
- Android log 管理工具
1.logger 项目地址: https://github.com/orhanobut/logger 2.KLog 项目地址:https://github.com/ZhaoKaiQiang/KLog ...
- Android Log Tag含义
在分析Android问题的时候重要的手段之一就是分析log,在events.log中有很多系统log,其中有些log的含义并不是很了解,下面就是从安卓源码中得到的系统log的tag. 关于Tag的说明 ...
- android log
from 点击打开链接 使用Android logcat 对我们开发.调试Android程序有很大的帮助!通过logcat,我们可以非常方便的了解到程序的执行情况,判断出错代码位置. 最简单的log ...
- Android Log介绍
android.util.Log常用的方法有以下5个:Log.v() ,Log.d() ,Log.i() ,Log.w() ,Log.e() .按照日志级别从高到低为ERROR, WARN, INFO ...
- Android Log图文详解
android.util.Log常用的方法有以下5个:Log.v() Log.d() Log.i() Log.w() 以及 Log.e() .根据首字母对应VERBOSE,DEBUG,INFO, WA ...
随机推荐
- angular中的ng-options 用法
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>& ...
- JUnit pass/failure/error区别
pass:被测程序没有抛出异常,得到的是预期的值. failure:被测程序的逻辑有错误,得不到预期的值.执行了JUnit的断言. error:被测程序本身抛出异常,还没有执行到JUnit的断言就抛出 ...
- python 爬虫不停换代理
内网看到的一个小技巧,卧槽,感觉真TM厉害 函数均放到main函数内即可 def get_proxy(): url="http://www.xicidaili.com" req=u ...
- Oracle 删除重复数据只留一条(转)
转自:http://www.cnblogs.com/252e/archive/2012/09/13/2682817.html 查询及删除重复记录的SQL语句 1.查找表中多余的重复记录,重复记录是 ...
- SpringMVC统一转换null值为空字符串的方法
在SpringMVC中,可以通过在<mvc:annotation-driven>中配置<mvc:message-converters>,把null值统一转换为空字符串,解决这个 ...
- android: 发送自定义广播
5.3.1 发送标准广播 在发送广播之前,我们还是需要先定义一个广播接收器来准备接收此广播才行,不然发 出去也是白发.因此新建一个 MyBroadcastReceiver 继承自 Broadca ...
- verilog语法实例学习(11)
同步时序电路的一般形式 时序电路由组合逻辑以及一个或多个触发器实现.一般的架构如下图所示:W为输入,Z为输出,触发器中存储的状态为Q.在时钟信号的控制下,触发器通过加在其输入端的组合逻辑输入,使得电路 ...
- Install windows server 2008 on ESXi 5.1, add to domain and config for remote desktop
Never give up ---xingyunpi Install windows server 2008 system on ESXi 5.1, add it to a domain and do ...
- [Functional Programming] From simple implementation to Currying to Partial Application
Let's say we want to write a most simple implementation 'avg' function: const avg = list => { let ...
- Java 迭代器综述
一.摘要 迭代器模式是与集合共生共死的.一般来说.我们仅仅要实现一个容器,就须要同一时候提供这个容器的迭代器.使用迭代器的优点是:封装容器的内部实现细节,对于不同的集合,能够提供统一的遍历方式,简化c ...