首先:引用Log4net.dll,按照说明进行web.config配置

然后:在Global中写入:

protected void Application_Start(object sender, EventArgs e)
        {
            log4net.Config.XmlConfigurator.Configure();
        }

然后:继续在Global中写入:

        protected void Application_Error(object sender, EventArgs e)
        {
            ILog log = LogManager.GetLogger(typeof(Global));
            log.Error("服务器发生异常:\r\n", Context.Error);
        }

 

相关文章:

  • 2021-08-19
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2021-12-15
猜你喜欢
  • 2022-12-23
  • 2021-07-20
  • 2022-12-23
  • 2021-08-14
  • 2021-09-19
  • 2022-02-02
  • 2021-11-02
相关资源
相似解决方案