我正在使用此代码检索logcat消息,并将它们编译为下面的arraylist(日志):
try {
process = Runtime.getRuntime().exec(new String[] {"logcat", "-d"});
} catch (IOException e1) {
e1.printStackTrace();
}
bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
try {
while ((line = bufferedReader.readLine()) != null){
System.out.println(line);
log.add(line);
}
}
bufferedReader.close();
}
catch (IOException e) {}
当我真正看到插入列表的内容时(通过打印'line'),我得到了两个不同的东西:
片剂:
D/UsbDeviceManager( 208): updateUsbNotification mConnected = true, mConnected = true, mCurrentFunctions = mtp,adb, mUsbNotificationId = 0
电话:
06-14 00:45:14.090 1687 3676 D *PJSIP_ANDROID*: Expires: 3600
为什么设备之间的logcat格式不同?我可以让平板电脑看起来像手机吗?
答案 0 :(得分:1)
您是否尝试过设置显式的logcat格式?
-v <format> Sets the log print format, where <format> is one of:
brief process tag thread raw time threadtime long