Android Studio new version Logcat quick review

This article mainly introduces the usage of Logcat in the new version of Android Studio.

blogger blog

First of all, once the new version of Logcat is upgraded, it cannot go back . You must uninstall and reinstall Android Studio to use the old version of Logcat. Since we can't go back, we embrace the changes and learn how to use the new version.

The new version of Android Studio already supports setting back to the old version of Logcat. For specific operations, go to File -> Settings -> Experimental -> Enable new Logcat tool window and uncheck it.

1. New features

interface

new logcat
The interface of the new version is different from that of the old version, mainly missing Regex (regular expression filtering), process selection box, custom filter drop-down selection, etc.

Multiple Logcat windows

new logcat mul
It is now possible to create multiple tabs in Logcat to easily switch between different devices. Right-click a tab to rename it, and click and drag to rearrange tabs.

If you want to compare the differences between two sets of logs, you can right-click in the logs view and select Split Right or Split Down to split the view within the tabs. To close the split, right-click the log view and select Close . Each split can set its own device connections, viewing options and queries.

Switch between view presets

Click to quickly switch between different view modes ( standard , compact and custom ), each of which provides different default settings for displaying more or less information such as timestamps, tags and process IDs (PID). You can also customize these default view modes as well as custom view modes by selecting Modify View .
insert image description here

Cross application crash/restart trace logs

When the application crashes and restarts, it produces PROCESS ENDED and PROCESS STARTED logs as follows:
insert image description here

Two, Logcat filtering

Note: For regular expressions and exceptions, please see the tag example below, all tags are common .

  1. package: Filter logs by package name, default package:minemeans to filter by the currently running application package name.
package:com.uso6
  1. level: filter logs by priority.
level:VERBOSE	// 显示所有信息
level:DEBUG	// 显示调试信息
level:INFO	// 显示一般信息
level:WARN	// 显示警告信息
level:ERROR	// 显示错误信息
level:ASSERT	// 显示抛出的断言
  1. tag: Filter logs by tags.
tag:nukix	// 过滤 nukix 的标签
tag:nukix tag:blog	// 同时过滤 nukix 和 blog 的标签
-tag:nukix	// nukix 的标签除外
tag~:[\w]+ // 以正则表达式过滤标签
-tag~:[\w]+	// 除外和正则表达式组合
  1. message: Filter logs with output logs.
  2. age: Keep logs for the specified age.
age:10s	// 从 10 秒以前的日志开始输出
age:1m // 从 1 分钟以前的日志开始输出
age:1h // 从 1 小时以前的日志开始输出
  1. line: Filter logs with line information (including tag and message).

Guess you like

Origin blog.csdn.net/dxk539687357/article/details/127094408