Logcat doesn't show Unity Debug.Log() outputs

Hello there,

Recently I needed to use Android Logcat for some debugging. But to my surprise, I couldn’t find a single Unity output. All other ADB Logcat outputs were there, yet unity was failing to show a single output.

For example I could see outputs with the tags “I/UnityAds” but there was nothing with “*/Unity” tag. I then proceeded to use Unity Android Logcat package instead of the Android Studio Logcat or the ADB Logcat from command line.

Yet even Unity didn’t see its own Debug.Log() outputs in the logcat, but it was showing up on the Unity console outputs. I made an empty project with a script that just screams “POTATO” at me with Debug.Log and I made it turn a cube GameObject on and off to see that the script was working.

Low and behold, it was working as intended! The console screamed “POTATO” at me, the cube was flickering on and off, yet the Logcat did not give me a single “POTATO” or any Unity tagged outputs.

Here’s the code:

using UnityEngine;

public class testDbg : MonoBehaviour
{
    private bool flag = true;
    public GameObject go;
    void Update()
    {
        Debug.Log("POTATO");       // This should scream POTATO at Logcat

        go.SetActive(!flag);    //This just visualizes that the code is working
        flag = !flag;
    }
}

Am I going insane? Isn’t this supposed to be working?

1 Like

Yes, this should be working. What version of Unity are you using? https://discussions.unity.com/t/699654

Could you paste a screenshot for Android Logcat window, just in case.

Hello, thanks for your time. I tried using it in both 2019.2.21f1 and version 2019.4.10f1 both failed unfortunately

6937579--815155--upload_2021-3-15_22-8-58.png

Here it is, it stops sending any new logs after the last two warnings, since it is an empty scene with nothing much going on I assume

Maybe it’s not even getting to Update(), can you place similar debug statements in Start() and Awake()? I use a command prompt as in the article I shared using “adb logcat” but they should also show in your output. Also, ensure you attach this script to a game object in your scene.

Maybe it’s a bug of some sort, what if you do

adb logcat

from terminal, without any filters, do you see your messages then?

What suspicious, is that tag column is empty for PlayerBase::PlayerBase()

Also, check Internal Log in logcat window in top right corner, it might show you additional error messages.

The game object is getting turned on and off, which would mean Update() works right?

6937984--815236--upload_2021-3-15_23-45-30.png

Well I see other messages with no filters as you can see and I also opened terminal to do the Command Line logcat and it works as well, its just unity thats not saying anything.

Then I guess Android Logcat window behaves as expected, as the same result is displayed by directly invoking adb logcat.

The question, is why messages are not coming through.
Did you try selecting Development check box in Build Settings window? Not sure if it will help, but a long shot, since if Development is unchecked, the application is “not debuggable”, maybe it affects logging.

Unfortunately it is checked. I am really mind boggled, I tried everything in the book, fresh installing Unity, fresh installing Android studio, outsourcing the adb and putting it in sdk, and the funny thing is everything EXCEPT unity is sending outputs, that’s why I am so irritated by it, hope in time a solution will emerge

Could you try creating a new empty project with simple script which calls Debug.Log or even Debug.LogError, and see if that changes anything.
Alternatively, could you try using another phone?

What was the result when you placed the statements in Start() and Awake()?

It works as expected for me. I did Build (vs Build and Run) and then “adb install mybuild.apk” to install on my Samsung Galaxy Edge S7 . Then I ran “adb logcat | findstr -i hello” (I’m on Windows, use grep on Mac) and saw my “Hello from Awake”, “Hello from Start”, and then a bunch of “Hello from Update”. I’m using 2020.1.13f1 but never saw an issue with Unity 2019 either.

I tried that and this is the project I am using as example, I will try using another phone to see if that shakes things up in my favor

Unfortunately didn’t work either, will try using a different phone

Use print() instead of Debug.Log(). I have been doing this for years across many projects. This problem is not new to me so I wonder what the setup is for people that say Debug.Log() works. Also, everyone says print is identical to Debug.Log but for me it is not so again, are people making statements without even verifying or is there some setting I’m not aware of?

7581307--939694--upload_2021-10-18_13-42-2.png


Same problem here, everyting works, but Debug.Log.
Unity version 2020.2.6f1
Could potentially some scripts intercept Debug.Log and stop it?

Edit:
print() or System.Console.WriteLine() doesn’t work either

Click on Priority and ensure Verbose is chosen

1 Like

It is chosen, but Debug.Log doesn’t appear like it was never actually called
7581487--939748--upload_2021-10-18_15-31-30.png