写了个service implements runnable
想要读取log信息,但是总是读不到,大大们帮我看看哪里出问题了。。
public void run() {
// TODO Auto-generated method stub
System.out.println("the function run()");
Process pro = null;
try {
Runtime.getRuntime().exec("logcat -d");
pro = Runtime.getRuntime().exec(new String[] { "logcat", "*:I" });
//pro = Runtime.getRuntime().exec("logcat");
} catch (IOException e) {
e.printStackTrace();
}
BufferedReader br= new BufferedReader(new InputStreamReader(pro.getInputStream()));
String line = null;
while (isCatchLog) {
try {
while ((line = br.readLine()) != null) {
String temp = logContent.toString();
logContent.delete(0, logContent.length());
logContent.append(line);
logContent.append("\n");
logContent.append(temp);
// 发送log内容
sendLogContent(logContent.toString());
Thread.yield();