I am using JBoss 4.2.
Long stack traces are useless to me most of the time. Is there a way to only show the error message? Can stack traces be disabled or trimmed for normal java programs also?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You may want to just log
myException.getMessage(), instead of usingmyException.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.