How to disable new Logcat in Android Studio Giraffe? – Android

by
Ali Hasan
android android-studio android-studio-girafee logcat

Quick Fix: Logcat has been deprecated. You can get close to the old Logcat by using "Compact Mode" and adjusting the settings.

The Problem:

After updating to Android Studio Giraffe 2023.3.1, the new Logcat mode has been enabled, despite being previously opted out. How can the old Logcat be restored?

The Solutions:

Solution 1: Use Compact Mode in New Logcat

Although there’s no option to revert to the old Logcat, you can achieve a similar experience with the new Logcat. To do this:

  1. Switch to "Compact Mode" from the Logcat dropdown menu.
  2. Disable unnecessary information by unchecking options in the "Settings" tab located in the top-right corner.

This setup offers a more concise and organized view, resembling the previous Logcat experience.

Solution 2: Modify Logcat Formatting Options

To disable the new Logcat and revert to the previous format:

  1. Open the Logcat view in Android Studio.
  2. Click the gear icon in the upper right corner to access the "Configure Logcat Formatting Options" menu.
  3. Select the "Modify Views" tab.
  4. Unselect all the options, including Timestamp, Tag, Level, Process ID, and Package Name.
  5. Click "OK" to apply the changes.

This will disable most of the new Logcat features and restore it to a format similar to the previous version.

Solution 3: Use the Timber Library

To disable the new Logcat in Android Studio Giraffe, consider using the Timber library. It allows you to filter out unwanted logs and customize the message format.

Follow these steps:

  1. Add the Timber dependency to your project:

    implementation 'com.jakewharton.timber:timber:4.7.1'
    
  2. Create a custom Timber Tree class to filter logs:

    class CustomTagTree(private val customTag: String) : Timber.DebugTree() {
    
        override fun createStackElementTag(element: StackTraceElement): String {
            return customTag
        }
    }
    
  3. Create an Application class and plant the custom Tree:

    class BaseApplication : Application() {
    
        override fun onCreate() {
            super.onCreate()
    
            if (BuildConfig.DEBUG) {
                Timber.plant(CustomTagTree("ihatethenewlogcat"))
            }
        }
    }
    
  4. Add the custom Application class name to your AndroidManifest.xml:

    <application
        android:name=".BaseApplication"
    
  5. Use Timber.d("Called") in your code and add a filter in the Logcat: tag:ihatethenewlogcat to view only the desired logs.

Q&A

How to disable new Logcat in Android Studio Giraffe?

There is no way to go back to the old Logcat. However, you can get close to what we had before Android Studio Giraffe by using the "Compact Mode" mode and adjusting the settings.

How to almost return to the previous format?

Open the logcat view, click side button "Configure Logcat Formatting Options", then "Modify views". Now unselect all options (or keep just Timestamp): Timestamp, Tag, Level, Process ID and Package Name.

How to filter log with Timber Library?

Implement Timber.plant(CustomTagTree("tagname")) and call your filter with Timber.d("yourmessage") in the logcat add tag:tagname filter.

Video Explanation:

The following video, titled "Android Studio NEW Logcat detail explanation | Detail Overview ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

How to use the new Android Studio Dolphin's Logcat, Full Guide 1. Enable the New Logcat 2. Log Structure 3. Logcat icons 4.