Android Studio 3.1 Logcat 前缀并不总是显示和破坏漂亮的记录器

Android Studio 3.1 Logcat prefix not always showing and breaking pretty logger

由于 Android Studio (3.1) 的新版本,Logcat window 并不总是显示前缀 (03-28 12:43:01.091 nl.test.app D/log)。我制作了自己的记录器,它以漂亮的方式打印,但是由于某些行不再具有相同的缩进,所以它被打破了。我将在下面展示一个例子。

03-28 12:43:01.091 nl.test.app D/log: ╔═══════════════════════════════════════════════════════════════════════════════════════
    ║ [ (TestActivity.kt:33)#OnCreate ] 
    ║ This is my test log
03-28 12:43:01.092 nl.test.app D/log: ║ This is my second test log
    ╚═══════════════════════════════════════════════════════════════════════════════════════

过去是这样的:

03-28 12:43:01.091 nl.test.app D/log: ╔═══════════════════════════════════════════════════════════════════════════════════════
03-28 12:43:01.091 nl.test.app D/log: ║ [ (TestActivity.kt:33)#OnCreate ] 
03-28 12:43:01.091 nl.test.app D/log: ║ This is my test log
03-28 12:43:01.092 nl.test.app D/log: ║ This is my second test log
03-28 12:43:01.092 nl.test.app D/log: ╚═══════════════════════════════════════════════════════════════════════════════════════

有什么办法可以解决这个问题吗?

根据问题跟踪器 (https://issuetracker.google.com/issues/77305804),它已修复并计划用于 Android Studio 3.2。引用问题跟踪器:

This change in behavior was inadvertent and I reverted it. The fix will go out in 3.2.

没有说这个版本什么时候发布。但我会尽快更新我的答案。

编辑

Android Studio 3.2 发布了,我漂亮的记录器又开始工作了!

观察正确。在 Android Studio 3.1.4 中它也被破坏了。不仅前缀不总是打印出来,而且完整的行也消失了。

但有一个小的解决方法:

  1. 在 Android Studio
  2. 中打开终端 Window
  3. 在您的目标中开始 shell:

    C:\directory> adb shell

  4. 其中 shell 开始 logcat 使用 grep 作为过滤器:

    device:/ $ logcat | grep

  5. 比您看到所有过滤条目的所有内容