First step, install Log4net and receive Log4net.xml file
After the installation is complete, locate Log4net.xml and place the file next to Global.asax in the root directory.
Go to the Log4net.xml file to find the <!--Debug only--and node
Change the name value of <logger name= "xxx" > Inside to start layer
The name of my startup layer here is mcsservice.
Find AssemblyInfo.cs files generally in the Properties folder below the boot layer
The last line in this file is added
[Assembly:xmlconfigurator (configfile = "Log4net.xml", Watch = True)]
Locate the Global.asax file and modify it inside.
Application_Start () Add a row above this method
private static readonly log4net. ILog log = Logmanager.getlogger (typeof (Mvcapplication));
The last line in this Application_Start () method joins
Xmlconfigurator.configureandwatch (New FileInfo (Server.MapPath ("Log4net.xml"));
Log. Debug ("log Started");
If there are some red wavy line error, right-click analysis can
Run your project and find the text file in the Logs folder in your boot layer's resource file to see your log.
Detailed installation steps for log4net in MVC