Log4NetCore library to easily integrate log4net in .NET Core applications

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 logger = serviceProvider.GetService()                
  .AddLog4NetCore("log4net.config")
  .CreateLogger();

Leave a Reply

Your email address will not be published.