Atitit.500 503 404错误处理最佳实践oak
1. 错误处理的流程(捕获>>日志>>db>>email alert)
1
2. 错误的捕获:struts级别,filter,jsp 级别,,app level
1
1. 错误处理的流程(捕获>>日志>>db>>email alert)
2. 错误的捕获:struts级别,filter,jsp 级别,,app level
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
2.1. Struts 的错误捕获
<package name="default" extends="struts-default" namespace="/weixin">
<!-- 拦截器todox login check machi o6c -->
<interceptors>
<!-- 登录验证 -->
<interceptor name="loginVerify" class="com.focustar.interceptor.LoginInterceptor"></interceptor>
<interceptor-stack name="verify">
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="loginVerify"></interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="verify"></default-interceptor-ref>
<global-results>
<result name="login">/refresh.jsp</result>
<!-- oae golbal ex process -->
<result name="root">/exception.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="root"/>
</global-exception-mappings>
<!-- end oae golbal ex process -->
2.2. jsp 的异常捕获
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
2.3. app level异常捕获
<web-app>
<error-page>
<error-code>500</error-code>
<location>/err/ubye.jsp</location>
</error-page>
<error-page>
<error-code>503</error-code>
<location>/err/ulinse.html</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/err/slins.html</location>
</error-page>
</web-app>
3. 错误日志
应用日志
服务器日志
文件日志
页面日志
数据库日志