Tag: Log4Net

Log4NetCore library to easily integrate log4net in .NET Core applications

Author: | Categories: Linux, Programming, Windows No Comments
Log4NetCore Log4NetCore is a .NET Core library to easily integrate log4net in .NET Core applications Nuget https://www.nuget.org/packages/Log4NetCoreEx/ Github https://github.com/rizansari/Log4NetCore Installation Install-Package Log4NetCoreEx Using the library Logging Builder How to use using Logging Builder var serviceProvider = new ServiceCollection() .AddLogging(loggingBuilder => { loggingBuilder.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); loggingBuilder.AddLog4Net(); loggingBuilder.AddConsole(); }) .BuildServiceProvider(); Services Collection How to use using Services Collection var […]

Log4net logging in asp.net MVC

Author: | Categories: Programming No Comments
Make changes in web.config file as follows <configuration> <configSections> ... <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> </configSections> <appSettings> ... <add key="log4net.Config" value="log4net.config"/> <add key="log4net.Config.Watch" value="True"/> </appSettings> <log4net> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file type="log4net.Util.PatternString" value="D:/Logs/TTG SmartANPR REST Service/smartanprrest_%date{ddMMyyyy}.log" /> <appendToFile value="true" /> <rollingStyle value="Date" /> <datePattern value="yyyyMMdd" /> <staticLogFileName value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date %level - %message%newline" […]