I've developed a number of libraries and applications targeting the .NET Framework, and in those cases I used the Common.Logging abstraction library within my libraries and adapted it to use Log4Net within the consuming applications.

This setup worked okay for me, but I'm now trying to port all my C# code to .NET Core and I'm wondering if this is still the best approach. I've mostly completed the migration and I've continued using a prerelease version of Common.Logging within my ported libraries (specifically v3.4.0-Beta2). However, in a top-level ASP.NET Core application that consumes these libraries, I don't believe I can bridge them with Log4Net anymore (it doesn't seem to be ported to .NET Core yet) and it doesn't seem to be picking up my logger configuration settings in web.config, meaning at runtime it selects the no-op version of the loggers.

It might be possible that I can fix it to work with Common.Logging still, but I'd like to get ideas for possibly better alternative approaches before making any changes.

In short, I'm looking for software recommendations on logging tools to use within .NET Core. For those of you writing libraries and applications targeting .NET Core, which do you use? Do you use Microsoft.Extensions.Logging? I've heard a lot of praise surrounding LibLog for logging within libraries - how about that? I'm also considering using Serilog within my ASP.NET Core applications in place of Log4Net.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.