Android Studio will update Logcat configuration filtering in October 2022

15801082:

Two days ago, Android Studio automatically updated in the background. After using the Logcat logging tool, it changed its appearance. People were at a loss. I thought something was wrong. After a while, an update prompt popped up. After the update, I found that the most important update was Logcat. The new Logcat is not as convenient as before, but it is more flexible. Let's see how to filter logs

renderings

Filter by package name:

//输入package:(输入一个p就会有提示的) ,然后后面跟上你的包名
package:com.mtc.automachinetool

filter by log level

// 输入level: ,后面加上等级,如info,debug,warning等
// 当等级为Info时,过滤Info及以上的日志
level:info 

Filter by Tag

// 输入tag: ,后面跟上你要过滤的TAG 字符
tag:cameratest

filter by keyword

// 输入message: , 后面跟上你要过滤的关键字
message:TestActivity

Combined filtering (package name + TAG + level + keyword)

// package tag message 可多次使用进行组合
// 这里是对com.mtc.automachinetool包进行Info等级的日志过滤,过滤TAG 为AutoMachineLog 和 
// cameratest,在过滤这些日志里面的带有false和失败关键字的日志
package:com.mtc.automachinetool level:info tag:AutoMachineLog tag:cameratest message:false message:失败

regular expression filter

// 只有这些字段支持正则表达式:tag、package、message、line
// 正则表达式匹配通过在字段名称中附加 ~ 来表示。例如 tag~:Android[\S]*。
tag~:Android[\S]*

Filter the logs you don't want to see (for the logs that print quickly and disturb our observation)

// 如果你的日志中有很多无用的且快速打印的日志,影响我们观察日志输出,那我们可以过滤掉他们
// 否定的表示方式是在字段名称前面加上 - 例如
-tag:Android

 Filter logs by time (only see logs within a certain period of time)

// age是过滤最近时间段内的日志,s 表示秒,m 表示分钟,h 表示小时,d 表示天。
// 下面的例子是过滤过去 5 分钟内记录的消息。
age:5m

Of course, you can also filter several of them. Filter according to your needs

The old version can only filter a package name, or a TAG, or a keyword, but the new version is still very easy to use.

If you like my blog, please like it.

Guess you like

Origin blog.csdn.net/baoolong/article/details/127572422