In VS 2013, create a new web application project. Go to NuGet, and search for Log4net, and install it in your web project.
In your /Bin folder, you should see the log4net dll and xml file
And you should see log4net in the Reference
(If you cannot see the /bin folder, click “Show All Files” in your project.)
Now we want to put the log4net configuration information in a separate file under the application root, called Log4Net.config
Here is the Log4Net.config
Open AssemblyInfo.cs and add this line in the end:
Add a line to web.config in the configSections tag.
Add to Startup.cs
In the caller (ASPX.CS), add these:
These log files are created under the root:
What the log file looks like:
To use Window’s event log to log information, add a new “appender” section to Log4net.config, and change the root section so the EventLogAppender is used for logging.
Run the application again, and you will see the logs in Event Log: