<p>What's the easiest way to print a stacktrace from a debugging printout? Often during testing you would like to know the callstack leading up to the situation provoking a debug message.</p>

You should be catching the exception in a try-catch block.
```
```
e.getStackTrace();
```
```
That returns StackTraceElement[] that you can then interpret.
Also:
```
```
e.printStackTrace()
```
```
will...print the stacktrace.