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

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

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

    JUST DO IT ~

    我只想當個程序員

    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 小高 閱讀(329) 評論(0)  編輯  收藏 所屬分類: DotNet

    導航

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

    統計

    常用鏈接

    留言簿(3)

    隨筆分類(352)

    收藏夾(19)

    關注的blog

    手冊

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 免费看内射乌克兰女| 亚洲暴爽av人人爽日日碰| 国产日韩在线视频免费播放| 免费一区二区视频| 老司机午夜免费视频| 男人的天堂亚洲一区二区三区| 亚洲jjzzjjzz在线播放| 毛片A级毛片免费播放| 亚洲精品久久久久无码AV片软件| 毛片a级毛片免费播放下载| 亚洲国产欧美一区二区三区| 精品国产免费观看一区| 国产亚洲人成在线影院| 亚洲一区二区三区国产精品| 97国免费在线视频| 久久亚洲日韩精品一区二区三区| 免费能直接在线观看黄的视频| 2017亚洲男人天堂一| 国产又大又粗又硬又长免费 | 午夜免费1000部| 亚洲a级在线观看| jizzjizz亚洲| 免费无码av片在线观看| 久久精品国产亚洲AV嫖农村妇女| 我的小后妈韩剧在线看免费高清版 | 羞羞网站在线免费观看| 亚洲熟妇丰满多毛XXXX| 99久久免费国产香蕉麻豆| 亚洲av成人一区二区三区在线播放 | 久久综合亚洲色hezyo| 亚洲无人区一区二区三区| 18级成人毛片免费观看| 国产精品无码亚洲精品2021| 国产亚洲一区二区在线观看| 四虎永久在线观看免费网站网址 | av免费不卡国产观看| 羞羞视频免费观看| 亚洲第一页中文字幕| 亚洲成av人片在线观看天堂无码| 国产99视频精品免费专区| 亚洲女子高潮不断爆白浆|