0

错误页面配置为:

<error-page>
    <error-code>404</error-code>
    <location>/common/general-error.jsp</location>
</error-page>
<error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/common/general-error.jsp</location>
</error-page>

一般错误.jsp:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page isErrorPage="true" %>
  <%
  String referer = request.getHeader("Referer");
  if (referer != null && !"null".equals(referer) && !referer.contains("googleads.g.doubleclick.net/pagead")) {
    Logger.getLogger(this.getClass().getName()).severe("GENERAL ERROR MESSAGE: requestUrl= " + request.getRequestURI() + "?" + request.getQueryString() 
          +  ",      referer:" + referer);
  }
if (exception != null) {
  Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "ERROR CAUSE:" +    exception.getMessage(), exception);
  }

显然,在我们每秒收到大约 20 个请求的 Web 应用程序中,大多数日志不包含exception. 所以exception几乎总是空的!我觉得很奇怪。

知道这可能是什么根本原因吗?如果这很重要,我们正在使用 glassfish。

顺便说一句,引荐来源网址打印正确,来自日志的快照:

[#|2013-10-31T02:32:55.903+0100|SEVERE|glassfish3.1.2|org.apache.jsp.common.general_002derror_jsp|_ThreadID=67;_ThreadName=Thread-2;|GENERAL ERROR MESSAGE: requestUrl= /LivingCost/common/general-error.jsp?null, referer:http://www.priceline.com/delta-grand-okanagen-resort-and-conference-centre-kelowna-british-columbia-BC-144934-hd.hotel-reviews-hotel-guides|#]

[#|2013-10-31T02:37:23.471+0100|SEVERE|glassfish3.1.2|org.apache.jsp.common.general_002derror_jsp|_ThreadID=21;_ThreadName=Thread-2;|GENERAL ERROR MESSAGE: requestUrl= /LivingCost/common/general-error.jsp?null, referer:http://www.numbeo.com/cost-of-living/country_result.jsp?country=Taiwan|#]

[#|2013-10-31T02:37:23.663+0100|SEVERE|glassfish3.1.2|org.apache.jsp.common.general_002derror_jsp|_ThreadID=37;_ThreadName=Thread-2;|GENERAL ERROR MESSAGE: requestUrl= /LivingCost/common/general-error.jsp?null, referer:http://www.numbeo.com/cost-of-living/country_result.jsp?country=Taiwan|#]

4

0 回答 0