我想过滤一个logcat
String myCommand="logcat -f /sdcard/output.txt"; //no filters, keep writing
myCommand="logcat -d -f /sdcard/output.txt"; //no filters, just a dump
对我来说工作正常,但对 mytag 则不然。
我也在使用代码:
String myCommand="logcat myTag *:S"; //the equivalent of logcat -s myTag
myCommand="logcat -s myTag:D";
myCommand="logcat -s myTag:E myTag2:D";
myCommand="logcat myTag:E myTag2:D";
但它返回空文件。
try {
File filename = new File(Environment.getExternalStorageDirectory()+"/gphoto4.html");
filename.createNewFile();
String cmd = "logcat -d -f "+filename.getAbsolutePath();
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
also use
String cmd = "logcat -v time -r 100 -f <filename> [TAG]:I [MyApp]:D *:S";
Runtime.getRuntime().exec(cmd);
-v -> Sets the output format for log messages.
-r -> for specifying the size of file.
-f -> file to which you want to write the logs.
[TAG] -> Tag of your application's log.
[MyApp] -> Your application name.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)