Filtering app server console output in Eclipse to not include long stack traces and just show me the error message?
I am using JBoss 4.2.
Long stack traces are useless to me most of the time.开发者_Python百科 Is there a way to only show the error message? Can stack traces be disabled or trimmed for normal java programs also?
You may want to just log myException.getMessage()
, instead of using myException.printStackTrace()
or something similar.
In web servlets, often the whole stack trace isn't that useful because the error is in your own code, i.e. the top several calls, and the rest of the stack is almost always the same servlet framework calls. Given the rest of the request data, it may not be very useful.
But, there is still occasionally value in the full stack trace. For instance, if you ever suspect that a bug in JBoss is causing your application to fail, you will probably need the full trace to track it down. So, rather than just reading logs directly, consider using a log-viewing application that can show and hide details. Log viewers typically let you filter by error level or search terms too. Google App Engine has a good one. I suggest you see what JBoss has to offer (if you don't know already -- I have no idea personally) and then check for third-party alternatives.
精彩评论