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 1,091 times
1 Answers
5
- 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
- 14,080
- 5
- 48
- 107

copeg
- 8,290
- 19
- 28