Configure Java installation to print only the first lines of the stack trace

How can I configure the default trace trace behavior of java so that only the head is visible? I am currently using 2>&1 | heador | less -i, and I find it suboptimal.

If there is an uncaught exception, Java prints to me 115 lines, and then the text ... 102 more. From 99% to 97% of this trace does not matter to me. This leaves the first 3 lines interesting.

How to configure Java to print 2 lines, and then, in my example ... 215 more,?

+4
source share
1 answer

You can specify a JVM parameter MaxJavaStackTraceDepth:

-XX:MaxJavaStackTraceDepth=2

script. IDE, VM VM arguments. .

. http://stas-blogspot.blogspot.kr/2011/07/most-complete-list-of-xx-options-for.html#MaxJavaStackTraceDepth

+4

All Articles