Since the new version of Android Studio (3.1) the Logcat window doesn't always show the prefix (03-28 12:43:01.091 nl.test.app D/log
). I made my own logger, which prints in a pretty way, but this gets broken since some lines are no longer with the same indentation. I'll show an example below.
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
╚═══════════════════════════════════════════════════════════════════════════════════════
This is how it used to be:
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: ╚═══════════════════════════════════════════════════════════════════════════════════════
Is there a way I can fix this?
According to the issue tracker (https://issuetracker.google.com/issues/77305804) it is fixed and is planned for Android Studio 3.2. To quote from the issue tracker:
This change in behavior was inadvertent and I reverted it. The fix will go out in 3.2.
It does not say when this version will be released. But I'll update my answer as soon as I know.
Edit
Android Studio 3.2 is released and my pretty logger is working again!
The observation is correct. In Android Studio 3.1.4 it is also broken. Not only the prefix is not printed always, also complete lines dissappear.
But there is a small workaround:
- open the Terminal Window in Android Studio
start a shell in your target:
C:\directory> adb shell
in that shell start logcat with grep as filter:
device:/ $ logcat | grep
than you see all filtered entries with all contents
来源:https://stackoverflow.com/questions/49535163/android-studio-3-1-logcat-prefix-not-always-showing-and-breaking-pretty-logger