How to get Debug.Log messages to appear

I noticed that Debug.Log messages from my app’s
scripts are not appearing in the Android adb logcat — or in the Android debug window that now appears.

Is there a special checkbox or debug mode that has to be enabled? I see other debug messages (not from my scripts) coming through fine.

Thank you

Unity Editor version: 2022.3
ML2 OS version: 1.11.0
Unity SDK version: 2.6.0

Hello,

Unity debug log messages should be written to logcat. I don't believe that any additional configuration should be necessary. I wonder if they may have been filtered out. It sounds like you may have tried already, but I'd suggest running adb logcat filtered to show verbose Unity log messages and see what happens. Here's a command you can run with your ML2 connected via adb-
adb logcat -v color "Unity:V *:S"

Unity also provides a package with some editor extensions that allow you to monitor logcat from the Unity editor. You might want to give it a try as well. Here are instructions for using the package provided by Unity-

  1. Install the Package: In Unity, go to Window > Package Manager. Search for "Android Logcat" and install it.
  2. Open the Logcat Window: Go to Window > Analysis > Android Logcat.
  3. Check for Logs: Run your app on your device. The logs should appear in the Android Logcat window.
  4. When running your application, make sure that the logger is connected to Magic Leap 2.

Ensure that you haven't filtered out the Debug.Log messages. Sometimes, the logcat might be set to show only errors or warnings.

Best,
Adam

1 Like

Mystery solved: The issue was with a library I was using. They had the following code, which disabled logging when deployed to the device.

#if UNITY_EDITOR
        Debug.unityLogger.logEnabled = true;
#else
        Debug.unityLogger.logEnabled = false;
#endif
1 Like