Java / Android – How to print out a full stack trace?

The following should do the trick:

Log.d("myapp", Log.getStackTraceString(new Exception()));

Note that ...x more at the end does not cut off any information from the stack trace:

(This indicates) that the remainder of the stack trace for this exception matches the indicated number of frames from the bottom of the stack trace of the exception that was caused by this exception (the “enclosing” exception).

…or in other words, replace x more with the last x lines from the first exception.

Leave a Comment