<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    JUST DO IT ~

    我只想當(dāng)個(gè)程序員

    log4 net 出錯(cuò) 定位行 的能力 LocationInfo using System.Diagnostics;


    片段 "


     public LocationInfo(Type callerStackBoundaryDeclaringType)
      {
       // Initialize all fields
       m_className = NA;
       m_fileName = NA;
       m_lineNumber = NA;
       m_methodName = NA;
       m_fullInfo = NA;

    #if !NETCF
       if (callerStackBoundaryDeclaringType != null)
       {
        try
        {
         StackTrace st = new StackTrace(true);
         int frameIndex = 0;

         // skip frames not from fqnOfCallingClass
         while (frameIndex < st.FrameCount)
         {
          StackFrame frame = st.GetFrame(frameIndex);
          if (frame != null && frame.GetMethod().DeclaringType == callerStackBoundaryDeclaringType)
          {
           break;
          }
          frameIndex++;
         }

         // skip frames from fqnOfCallingClass
         while (frameIndex < st.FrameCount)
         {
          StackFrame frame = st.GetFrame(frameIndex);
          if (frame != null && frame.GetMethod().DeclaringType != callerStackBoundaryDeclaringType)
          {
           break;
          }
          frameIndex++;
         }

         if (frameIndex < st.FrameCount)
         {
          // now frameIndex is the first 'user' caller frame
          StackFrame locationFrame = st.GetFrame(frameIndex);

          if (locationFrame != null)
          {
           System.Reflection.MethodBase method = locationFrame.GetMethod();

           if (method != null)
           {
            m_methodName =  method.Name;
            if (method.DeclaringType != null)
            {
             m_className = method.DeclaringType.FullName;
            }
           }
           m_fileName = locationFrame.GetFileName();
           m_lineNumber = locationFrame.GetFileLineNumber().ToString(System.Globalization.NumberFormatInfo.InvariantInfo);

           // Combine all location info
           m_fullInfo =  m_className + '.' + m_methodName + '(' + m_fileName + ':' + m_lineNumber + ')';

          }
         }
        }
        catch(System.Security.SecurityException)
        {
         // This security exception will occur if the caller does not have
         // some undefined set of SecurityPermission flags.
         LogLog.Debug("LocationInfo: Security exception while trying to get caller stack frame. Error Ignored. Location Information Not Available.");
        }
       }
    #endif
      }





    posted on 2009-10-01 00:02 小高 閱讀(343) 評(píng)論(0)  編輯  收藏 所屬分類: DotNet

    導(dǎo)航

    <2009年10月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    統(tǒng)計(jì)

    常用鏈接

    留言簿(3)

    隨筆分類(352)

    收藏夾(19)

    關(guān)注的blog

    手冊(cè)

    搜索

    積分與排名

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 亚洲人成网站影音先锋播放| 亚洲精品国产成人中文| 黑人大战亚洲人精品一区| 亚洲蜜芽在线精品一区| 黄色三级三级三级免费看| 最近高清中文字幕免费| 亚洲av手机在线观看| 国产亚洲人成网站在线观看| 亚洲天堂男人影院| 鲁丝片一区二区三区免费| 免费观看国产小粉嫩喷水| 亚洲videos| 1000部禁片黄的免费看| 永久亚洲成a人片777777| 韩国免费a级作爱片无码| 免费观看国产小粉嫩喷水| 一级做a爰片久久毛片免费陪 | 国产91精品一区二区麻豆亚洲| 亚洲人成电影在线观看青青| a级毛片免费全部播放| 亚洲精品99久久久久中文字幕| 亚洲中文字幕日本无线码 | 亚洲国产综合久久天堂| 久久免费视频一区| 亚洲国产午夜中文字幕精品黄网站 | 99re在线精品视频免费| 国产精品亚洲一区二区三区在线| 色一情一乱一伦一视频免费看| 亚洲日韩在线第一页| 色欲A∨无码蜜臀AV免费播| 国产亚洲精品美女久久久| 蜜桃AV无码免费看永久| 亚洲第一综合天堂另类专| 好吊妞788免费视频播放| 亚洲精品亚洲人成在线播放| 国产网站在线免费观看| 亚洲AV无码一区二区大桥未久 | 久久精品国产亚洲av麻豆蜜芽 | 久久久久久精品免费看SSS| 亚洲国产精品久久久久| 成人午夜性A级毛片免费|