简体   繁体   中英

How can I get logcat data with ddmlib?

I'm coding an utility to make a showcase movies on the PC of the apps running on the Android devices. I was able to do it using xuggler ( http://www.xuggle.com/xuggler ) and ddmlib. It is really easy to obtain image as RawImage from the Android's adb using ddmlib, but now i need to get Logcat data from the moments when I shot the movie. I can't find any examples to obtaint he Logcat data; the logcat package has some classes to handle Logcat messages, but none to instantiate it. Anybody, help! I'll be glad to see any example how to obtaing logcat messages using ddmlib.

I have fount that it is possible using

LogCatReceiverTask lcrt;
LogCatListener lcl;
lcrt=new LogCatReceiverTask(devices[0]);
lcl= new LogCatListener() {
            @Override
            public void log(List<LogCatMessage> msgList) {
                System.out.println("Called with messages list length "+msgList.size());
                for (LogCatMessage msg : msgList) {
                    // System.out.println(msg.toString());
                    /*

                    System.out.println(msg.getTime());
                    System.out.println(msg.getPid());
                    System.out.println(msg.getLogLevel());
                    System.out.println(msg.getAppName());
                    System.out.println(msg.getTag());
                    System.out.println(msg.getTid());
                    System.out.println(msg.getMessage());
                    */
                    logcat = logcat + msg.toString() + "\n";
                }
            }
        };

    }

Thank llya Yevlampiev,This help me developing android logcat api on ddmlib.

Custom Logfilter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM