When a AWT/swing application encounters an exception a very long stack trace is printed with lots of unnecessary information. Is there a way to only print the part that is relevant to my code and not everything which has to do with the swing/awt part?
Asked
Active
Viewed 818 times
1 Answers
4
- If you are catching the
Exceptions(which you should be), rather than directly callingprintStackTrace()you could manually print (or exclude) each element by getting the StackTraceElements fromThrowable.getStackTrace() - If you are using a logging library, you can change the output by changing the output of the library. For example, here's an example with log4j that changes the output
- You can fiddle with the -XX:MaxJavaStackTraceDepth JVM option
Gerold Broser
- 13,129
- 4
- 41
- 97
copeg
- 8,210
- 18
- 28