In debug mode all normal, but in release mode log4net not work, check a lot of information, finally solved. Do the following to check the changes.
1, check log4net write log file path is correct;
2, check the corresponding log file path has permission;
3, check the program log4net configuration to obtain the path;
The most common problem is the third step, which typically writes the following code in the AssemblyInfo.cs file
[Assembly:log4net. Config.xmlconfigurator (configfile = "Log4net.config", configfileextension = "config", Watch = True)]
However, this mode is not a problem in debug mode, but it is not good in release mode, you need to specify the location of the configuration file in the Global.asax file again, for example:
protected void Application_Start (object sender, EventArgs e)
{
Log4net. Config.XmlConfigurator.Configure (New FileInfo (Server.MapPath ("~") + @ "\log4net.config"));
}
Recompile the publication.
Log4net Unable to generate file or write log in release mode