log4net简单配置与应用


1:添加log4net.dll引用
2:建Log4Net.config  
      包含具体设置参数
3: Global.asax
   protected void Application_Start(object sender, EventArgs e)
  {
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(Server.MapPath("~") + @"\Log4Net.config"));
        }
4:代码使用实例
   protected void Button1_Click(object sender, EventArgs e)
        {
        
            log4net.ILog Logger = log4net.LogManager.GetLogger(this.GetType());
            Logger.Info("log test test log");
        }

Log4NET配置与使用实例.rar

原文地址:https://www.cnblogs.com/smallfa/p/1754205.html