<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)個程序員

    log4 net 出錯 定位行 的能力 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) 評論(0)  編輯  收藏 所屬分類: DotNet

    導(dǎo)航

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

    統(tǒng)計(jì)

    常用鏈接

    留言簿(3)

    隨筆分類(352)

    收藏夾(19)

    關(guān)注的blog

    手冊

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 五月婷婷综合免费| 67194熟妇在线永久免费观看| WWW国产成人免费观看视频| 国产一级a毛一级a看免费人娇| 免费人成在线观看网站| 97性无码区免费| 亚洲日本香蕉视频| 一级毛片免费播放视频| 57pao一国产成视频永久免费| 韩国二级毛片免费播放| 久久亚洲国产精品123区| 亚洲三级视频在线观看 | 亚洲制服丝袜精品久久| 人妻巨大乳hd免费看| 在线永久免费的视频草莓| 亚洲国产精品综合一区在线| 免费在线观看h片| 亚洲乱码中文字幕久久孕妇黑人 | 在线永久免费的视频草莓| 亚洲精品视频久久| 99久久99这里只有免费的精品| 无码国产精品一区二区免费I6| 亚洲精品国产精品乱码视色 | 最近中文字幕国语免费完整| 在线精品亚洲一区二区小说 | 亚洲&#228;v永久无码精品天堂久久| 久久久无码精品亚洲日韩蜜臀浪潮 | 免费国产美女爽到喷出水来视频| 久久久无码精品亚洲日韩京东传媒| a一级毛片免费高清在线| 永久亚洲成a人片777777| 最近免费视频中文字幕大全| 性xxxx黑人与亚洲| 国产在线jyzzjyzz免费麻豆 | 亚洲精品白色在线发布| 免费黄网在线观看| 国产A∨免费精品视频| 亚洲男人第一av网站| 久久久久久免费一区二区三区| 亚洲精彩视频在线观看| 国产jizzjizz免费看jizz|