本文介绍了阅读过滤日志猫(编程)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何读取过滤日志的猫,其中等级
是警告?
这是我所知道....
的logcat =调用Runtime.getRuntime()EXEC(新的String [] {的logcat,D});
BR =新的BufferedReader(新的InputStreamReader(logcat.getInputStream()),4 * 1024);
串线;
最后StringBuilder的日志=新的StringBuilder();
串隔板= System.getProperty(line.separator);
而((行= br.readLine())!= NULL)
{
log.append(线);
log.append(分隔符);
}
解决方案
-s标志,可以筛选logcat的输出基于标签和水平E,W,D,V,所以你可以尝试修改您的线路。
的logcat =调用Runtime.getRuntime()EXEC(新的String [] {的logcat,D, - S,*:W});
How can i read filtered log cat whereLevel
is Warning?
That's all i know....
logcat = Runtime.getRuntime().exec(new String[]{"logcat", "-d"});
br = new BufferedReader(new InputStreamReader(logcat.getInputStream()),4*1024);
String line;
final StringBuilder log = new StringBuilder();
String separator = System.getProperty("line.separator");
while ((line = br.readLine()) != null)
{
log.append(line);
log.append(separator);
}
解决方案
The -s flag lets you filter logcat output based on tag and level e,w,d,v so you can try modifying your line.
logcat = Runtime.getRuntime().exec(new String[]{"logcat", "-d","-s","*:w"});
这篇关于阅读过滤日志猫(编程)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!