简体   繁体   English

在Android中看到整个堆栈跟踪

[英]Seeing Entire Stack Trace in Android

I've been trying to debug my Android application and the bug has been fairly complicated so I need to know the exact stack trace. 我一直在尝试调试我的Android应用程序,该错误相当复杂,因此我需要知道确切的堆栈跟踪。

I have been using: 我一直在使用:

Log.d("DebugTag", Log.getStackTraceString(e1));

but I noticed that within LogCat, the Text for the error message gets truncated. 但是我注意到在LogCat中,错误消息的文本被截断了。 Hence, I can only see half the error statement even after saving the logs to a txt document. 因此,即使将日志保存到txt文档中,我也只能看到一半的错误语句。

Is there a more efficient work-flow for android developers to see the stack trace after an error has been detected? 在检测到错误之后,是否有更有效的工作流供android开发人员查看堆栈跟踪?

public static void v(String msg) { android.util.Log.v(TAG, buildMessage(msg)); } protected static String buildMessage(String msg) { StackTraceElement caller = new Throwable().fillInStackTrace().getStackTrace()[2]; return new StringBuilder() .append(caller.getClassName()) .append(".") .append(caller.getMethodName()) .append("(): ") .append(msg).toString(); }

I use this to log the message 我用它来记录消息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM