专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Android

想要读取log信息,但是总是读不到。写了个service implements runnable 想要读取log信息,但是总是读不到,大大们帮小弟我看看哪里出有关问题了

发布时间:2010-05-30 05:37:18 文章来源:www.iduyao.cn 采编人员:星星草
想要读取log信息,但是总是读不到。写了个service implements runnable 想要读取log信息,但是总是读不到,大大们帮我看看哪里出问题了
写了个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();
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: