Android adb logcat and stacktrace truncating

On Android, select Development Build (without Script Debugging selected) to see the stacktrace on any Debug.Log calls. This is useful to determine the path to what’s calling the Debug.Log.

From the device, when using adb logcat to push these logs to Terminal, each stacktrace becomes truncated.

On device in Developer Options, there is an option to increase “Buffer size for logging”, but this doesn’t prevent the truncation of stacktrace from Unity.

Any ideas how to keep the stacktrace from truncating?

What makes this so fun is that Unity occupies the first 4 lines of all stacktrace output from Debug.Log via:
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[ ])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)

And it’s not until you get past these 4 lines that you start to see any relevant/useful stacktrace output.

Is this additional UnityEngine output avoidable? Or perhaps theres a way to filter UnityEngine output in order to increase the output of useable content to stacktrace?

Posting because I feel like I’m missing something here, as current implementation is fairly useless for debugging.

1 Like

I don’t think i’ve ever since logs getting truncated. We rarely create development builds though, as they incur a significant performance overhead.

BTW - You can control the stack trace type using Application.stackTraceLogType which can be set to None (only the log message, no stack trace, ScriptOnly or Full).

i see the same:

1 Like

Massive bump. So frustrating.

Unfortunately, this is Android limitation. The OS limits how long a message can be. I think it also differs depending on device/OS version.

Yeah, seems like the only way to fix it is to recompile android with a larger buffer, so not plausible for most of us.

Not a great deal of utility versus just connecting a debugger with this limitation though, or am I missing a use case?