1

I want to get "last 25 logs of tag name CordovaLog" I tried

logcat -t 25 CordovaLog

I do get 25 logs but of all the tag names. Also what if there are no 25 Cordova Log ? Will it return whatever is available.

So what is the right command ? Thanks.

EDIT 1-

        Process process = Runtime.getRuntime().exec("logcat -d -t 25 CordovaLog:V *:S"); 
        BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream())); 
        StringBuilder log = new StringBuilder(); 
        String line;
        while ((line = bufferedReader.readLine()) != null)  
        { 
                log.append(line+"<br />");
        } 
        return log.toString();

So Is this code getting all the logs are filting to get "Cordova logs" ? OR it's just getting "Cordova logs" ? It's crashing as I have lots of logs.

4

1 回答 1

2

正确的用法是

logcat -d -t 25 CordovaLog:V *:S

这样,您将打印所有具有标签 CordovaLog 的内容,并将其他所有内容静音。
您可以在官方文档中获得更多信息。

编辑以修复正确的答案(见下面的评论)。它将打印最后 25 个条目,如果条目少于 25 个,则打印更少。

于 2013-07-24T18:16:09.110 回答