0

I'm developing using an older Java version which has no getStackTrace() method. There is a printStackTrace method but it's not printing where I want it.

Is there a way to extract the full contents of Exception ex (ex in this case, and a MXExeption)?

Cast to string array or something?

4

1 に答える 1

3

たぶんそれが役立ちます:

StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
String stacktrace = sw.getBuffer().toString();
于 2014-09-24T11:04:30.197 に答える