.net log4dll的使用

www.cnblogs.com/wangsaiming/archive/2013/01/11/2856253.html

LogHelper帮助类里不要忘记

[assembly: log4net.Config.XmlConfigurator(Watch = true)]这句话!!!



  try
            {
                LogHelper.WriteLog(typeof(Form1), "开始转换,下面有错哦!!!");
                string s = "123s";
                int i = Convert.ToInt16(s);
               

            }
            catch(Exception es){
                LogHelper.WriteLog(typeof(Form1), es);
            }
记录时间:2015-12-25 10:04:00,995 
线程ID:[9] 
日志级别:  ERROR 
出错类:WindowsFormsApplication1.Form1 property: [(null)] - 
错误描述:开始转换,下面有错哦!!!
 

 
记录时间:2015-12-25 10:04:01,057 
线程ID:[9] 
日志级别:  ERROR 
出错类:WindowsFormsApplication1.Form1 property: [(null)] - 
错误描述:Error
 
System.FormatException: 输入字符串的格式不正确。
   在 System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   在 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   在 System.Int16.Parse(String s, NumberStyles style, NumberFormatInfo info)
   在 System.Convert.ToInt16(String value)
   在 WindowsFormsApplication1.Form1.button1_Click(Object sender, EventArgs e) 位置 h:C#LearnWindowsFormsApplication1WindowsFormsApplication1Form1.cs:行号 24
喜欢的朋友请帮忙点个赞!!!
原文地址:https://www.cnblogs.com/mchuang/p/5075106.html