How do I get the current stack trace in Java, like how in .NET you can do Environment.StackTrace?
I found Thread.dumpStack() but it is not what I want -
Thread.dumpStack()
Maybe you could try this:
catch(Exception e) { StringWriter writer = new StringWriter(); PrintWriter pw = new PrintWriter(writer); e.printStackTrace(pw); String errorDetail = writer.toString(); }
The string 'errorDetail' contains the stacktrace.