Add log4net Package. Starting with log4net is as easy as installing a Nuget package. … Add log4net. config File. … Tell log4net to Load Your Config. The next thing we need to do is tell log4net where to load it’s configuration from so that it actually works. … Log Something!
Where do I put log4net in web config?
- <configSections>
- <section name=”log4net” type=”log4net.Config.Log4NetConfigurationSectionHandler,log4net” />
- </configSections>
- t;log4net>
- <appender name=”RollingFile” type=”log4net.Appender.RollingFileAppender”>
- <file value=”C:\Temp\nSightsLog.log” />
- <appendToFile value=”true” />
How do I add log4net to .NET core?
- Add the nugget package Microsoft.Extensions.Logging.Log4Net.AspNetCore.
- Add the log4net.config file in your root application folder.