Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a logging facade for the .NET world?

I'm somewhat new to the .NET stack and I was wondering if there is an equivalent to slf4j for the .NET platform. For me, logging to a Facade and being able to swap out logging implementations as needed just makes sense. Furthermore, the wrapper APIs available in slf4j have saved me many times when I needed to use a third-party library that was coded against a single logging framework that I wasn't using.

Is there a project out there that acts as a facade between loggers like log4net, nLog and Enterprise Library? Are there wrappers that allow me to shortcut calls to those libraries and direct them to another library? Should I start out an open source project to do this myself? Is this question a duplicate because I don't know the right way to ask? Conversely, is the common way to do this using aspect orient programming?

like image 512
Elijah Avatar asked Apr 28 '10 22:04

Elijah


People also ask

What are the best .NET logging frameworks?

NLog. NLog is one of the most popular, and one of the best-performing logging frameworks for . NET. Setting up NLog is fairly simple.

What is .NET logging?

ASP.NetServer Side ProgrammingProgramming. Logging is the process of recording events in software as they happen in real-time, along with other information such as the infrastructure details, time taken to execute, etc. Logging is an essential part of any software application.

Is SLF4J a facade?

Simple Logging Facade for Java (abbreviated SLF4J) acts as a facade for different logging frameworks (e.g., java. util. logging, logback, Log4j). It offers a generic API, making the logging independent of the actual implementation.

What is logging in .NET core?

Logging providers store logs, except for the Console provider which displays logs. For example, the Azure Application Insights provider stores logs in Azure Application Insights. Multiple providers can be enabled. The default ASP.NET Core web app templates: Use the Generic Host.


2 Answers

Excuse I used this thing and I forgot it wasn't the Apache version. It's actually open-source and part of a project called common infrastructure. It is also called common logging. It works with MS Enterprise, log4net and others. It works well.

like image 91
Tom Cabanski Avatar answered Sep 22 '22 02:09

Tom Cabanski


Take a look at Castle Windsor Logging Facility.

Base code is here. Log4net adapter here. NLog adapter here.

Added adapter for Serilog.

Without the adapters there is suppor for ConsoleLogger, DiagnosticsLogger, StreamLogger and NullLogger.

It's pretty easy to write adapters to any other logging framework.

like image 29
Mauricio Scheffer Avatar answered Sep 19 '22 02:09

Mauricio Scheffer