本文介绍了如何监控Android的亚行logcat,做一个grep的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以打印一些登录到Android的日志系统中的应用程序,它有一些关键词,我想监视,我想要实现的是:

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:

监视器亚行logcat输出,如果有一个新的生产线包含关键字,打印出新的生产线。

Monitor "adb logcat" output, if there is a new line contains the keyword, print out the new line.

这有点像亚行logcat | grep的命令,但你也知道亚行logcat将阻止那里,所以我的grep看不到任何输入。难道是可行的使用简单的shell脚本?

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?

推荐答案

如果你的,在标题为过滤日志输出,这说明 ADB 的本机的过滤功能。这可能会为你工作。你可以在你的日志报表指定一个特定的标签(这基本上是不管你会发送到庆典),然后就过滤这些标签。例如:

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

将是code,然后你会做

would be the code, and you'd then do

adb logcat filter1:V

过滤为输出。

to filter for that output.

编辑:您可以随时用它来记录到文件中,然后在运行庆典

you can always use this to dump to a file, and then run bash on that.

这篇关于如何监控Android的亚行logcat,做一个grep的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 16:56