夢(mèng)幻之旅

          DEBUG - 天道酬勤

             :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            671 隨筆 :: 6 文章 :: 256 評(píng)論 :: 0 Trackbacks
          <2008年10月>
          2829301234
          567891011
          12131415161718
          19202122232425
          2627282930311
          2345678

          公告

          本博客中未注原創(chuàng)的文章均為轉(zhuǎn)載,對(duì)轉(zhuǎn)載內(nèi)容可能做了些修改和增加圖片注釋,如果侵犯了您的版權(quán),或沒有注明原作者,請(qǐng)諒解

          常用鏈接

          留言簿(21)

          隨筆分類(644)

          隨筆檔案(669)

          文章檔案(6)

          最新隨筆

          積分與排名

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          package org.roadway.wisp.zd.util;

          import org.apache.log4j.Logger;

          import com.opensymphony.xwork2.ActionInvocation;
          import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

          /**
           * 
          @author Huyvanpull
           * 
           
          */
          @SuppressWarnings(
          "serial")
          public class ExceptionInterceptor extends AbstractInterceptor
          {
              
          private Logger logger = Logger.getLogger(ExceptionInterceptor.class);
              
              
          private String interceptorName;
              
              @Override
              
          public String intercept(ActionInvocation invocation) throws Exception
              {
                  
          this.logger.debug("進(jìn)入" + this.getInterceptorName());
                  String result 
          = null;
                  
          try
                  {
                      result 
          = invocation.invoke();
                  }
                  
          catch (Exception exception)
                  {
                      
          this.logger.error(this.getExceptionInfo(exception));
                      
          throw exception;
                  }
                  
          return result;
              }
              
              
          private String getExceptionInfo(Exception exception)
              {
                  StringBuffer bExceptionInfo 
          = new StringBuffer();
                  bExceptionInfo.append(exception.toString());
                  bExceptionInfo.append(
          "\n\t");
                  
                  StackTraceElement[] stackTraceElements 
          = exception.getStackTrace();
                  
          for (int i = 0; i < stackTraceElements.length; i++)
                  {
                      bExceptionInfo.append(
          "[" + this.getInterceptorName() + ""
                              
          + stackTraceElements[i].toString() + "\n\t");
                  }
                  
          return bExceptionInfo.toString();
              }
              
              
          public String getInterceptorName()
              {
                  
          return interceptorName;
              }
              
              
          public void setInterceptorName(String interceptorName)
              {
                  
          this.interceptorName = interceptorName;
              }
              
          }
          posted on 2008-10-13 14:29 HUIKK 閱讀(291) 評(píng)論(0)  編輯  收藏 所屬分類: Struts
          主站蜘蛛池模板: 原阳县| 休宁县| 高安市| 克拉玛依市| 应城市| 蓬溪县| 宜阳县| 宜都市| 鄂托克前旗| 沽源县| 大丰市| 石家庄市| 阳朔县| 鸡西市| 广汉市| 牙克石市| 临沧市| 晋宁县| 临西县| 安阳县| 长宁县| 新闻| 四平市| 望奎县| 翁源县| 特克斯县| 阿拉善左旗| 盘山县| 鱼台县| 华宁县| 息烽县| 江达县| 连城县| 保德县| 武清区| 通城县| 新泰市| 江达县| 屯门区| 上栗县| 洛川县|