Eljah
Eljah

Reputation: 5185

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.

Upvotes: 1

Views: 1405

Answers (2)

cosyman
cosyman

Reputation: 171

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

Custom Logfilter

Upvotes: 1

Eljah
Eljah

Reputation: 5185

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";
                }
            }
        };

    }

Upvotes: 2

Related Questions