获取一些堆栈跟踪信息到自定义的Tomcat错误500页面 [英] get some stack trace info into a custom tomcat error 500 page

查看:407
本文介绍了获取一些堆栈跟踪信息到自定义的Tomcat错误500页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用tomcat,spring,jsf将一些堆栈跟踪信息(也许是Exeception.message)放到我的自定义错误500页面上的最佳方法是什么?我只想显示出受害的根本原因.

What is the best way of getting some of the stack trace info, perhaps the Exeception.message onto my custom error 500 page with tomcat, spring, jsf? I'd just like the root cause of the exeception displayed.

推荐答案

这是我在Struts中使用的JSP语法.您可能可以使用JSf获得此功能或类似功能.

Here's the JSP syntax, which I have used with Struts. You can probably get this or similar working with JSf.

<!-- Get the exception object -->
<c:set var="exception" value="${requestScope['javax.servlet.error.exception']}"/>

<!-- Exception message(s) -->
<p>${exception.message}</p>
<p><c:if test="${not empty exception.cause.message}">${exception.cause.message}</c:if></p>

<!-- Stack trace -->
<jsp:scriptlet>
exception.printStackTrace(new java.io.PrintWriter(out));
</jsp:scriptlet>

这篇关于获取一些堆栈跟踪信息到自定义的Tomcat错误500页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆