<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 小高 閱讀(328) 評(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)論排行榜

    主站蜘蛛池模板: 国产亚洲高清不卡在线观看| a级毛片高清免费视频就| 亚洲专区先锋影音| 亚洲精品无码成人片在线观看| h片在线免费观看| 中文字幕在线视频免费观看 | 久久国产精品免费看| 美女被暴羞羞免费视频| 亚洲中文字幕精品久久| 亚洲国产综合在线| 麻豆亚洲AV永久无码精品久久| 亚洲伊人久久精品影院| 亚洲综合欧美色五月俺也去| 91久久亚洲国产成人精品性色| 亚洲综合无码AV一区二区| 国产免费久久精品| 成年女人永久免费观看片| 免费看韩国黄a片在线观看| 19禁啪啪无遮挡免费网站| 久久精品国产免费| 成人精品视频99在线观看免费| 色婷婷综合缴情综免费观看| 羞羞视频在线免费观看| 免费一级毛片在线播放放视频| 国产成人亚洲综合在线| 国产成人亚洲毛片| 青草青草视频2免费观看| 亚洲国产精品成人午夜在线观看| 亚洲愉拍一区二区三区| 亚洲日韩中文字幕一区| 亚洲日韩AV一区二区三区中文 | 黄页免费在线观看 | 亚洲国产精品婷婷久久| 久久精品7亚洲午夜a| 亚洲国产精品人久久| 777亚洲精品乱码久久久久久 | 一级特黄色毛片免费看| 一级人做人爰a全过程免费视频| 有色视频在线观看免费高清在线直播| 男女作爱免费网站| 中文字幕在线免费视频|