【Android】logcat日志信息过滤

原文:http://stackoverflow.com/questions/5511433/how-to-exclude-certain-messages-by-tag-name-using-android-adb-logcat


down voteaccepted

If you are using adb logcat you could pipe it through grep and use it‘s inverted matching: From the grep manpage:

v, --invert-match Invert the sense of matching, to select non-matching lines.

For example:

$adb logcat | grep --invert-match ‘notshownmatchpattern‘ 

You can extend this by using regular expressions.

Here is an example of such an expression:

"/^(?:emails|tags|addresses)"

This one would check for either of the given to occur, grep would then not list them.


过滤出指定tag的日志信息

^(?:tag1|tag2|tag3)


忽略指定tag的日志信息

^(?!tag1|tag2|tag3)


比如,我想忽略掉Tag中包含"SurfaceTextureClient"或"Trace"的日志信息,可以在过滤器的by Log Tag选项中配置"^(?!SurfaceTextureClient|Trace)"

技术分享


郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。