Issue
I have an application that can print some logs into android log system, it has some keywords that I want to monitor, what I want to achieve is:
Monitor "adb logcat" output, if there is a new line contains the keyword, print out the new line.
It's something like adb logcat | grep "command" but as you know adb logcat will block there so my grep can't see any input. Is it doable using simple shell script?
Solution
If you look at http://developer.android.com/guide/developing/tools/adb.html, in the section titled Filtering Log Output, this describes adb
's native filtering capabilities. This will probably work for you. You can specify a specific tag in your log statements (which would essentially be whatever you would have sent to bash
) and then just filter on those tags. For example:
android.util.Log.v("filter1","<this is my log statement>");
would be the code, and you'd then do
adb logcat filter1:V
to filter for that output.
EDIT: you can always use this to dump to a file, and then run bash
on that.
Answered By - Femi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.