<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/exceptionHandler</location>
</error-page>
以下是我在异常处理servlet的service
方法中所做的事情:
@Override
protected void service(HttpServletRequest req, HttpServletResponse arg1)
throws ServletException, IOException {
Object attribute = req.getAttribute("javax.servlet.error.exception");
if(attribute instanceof SocketException){
// don't do anything
}else{
super.service(req, arg1);
}
}.
问题:
当用户请求某些内容并关闭浏览器时,上述方法不起作用,并且堆栈跟踪会打印到控制台。
问题是:
当SocketException
发生时,如何停止将堆栈跟踪打印到JBoss控制台?
这样做的原因:
我想避免在一天结束时看到所有日志中的SocketException
,因为我无法对这些信息采取任何措施。