log4net with ASP.NET MVC: nothing happens

后端 未结 4 1809
挽巷
挽巷 2020-12-24 07:11

I am trying to use log4net with ASP.NET MVC and I cannot get anything to happen with it. I\'ve created a config that is in my web project root:



        
4条回答
  •  独厮守ぢ
    2020-12-24 07:31

    Do you have something like this in global.asax?

    void Application_Start(object sender, EventArgs e)
    {
        string l4net = Server.MapPath("~/log4net.config");
        log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(l4net));
    
        ...
    

提交回复
热议问题