views:

321

answers:

3

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?

+4  A: 

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.

Tom Cabanski
Yep, Common Logging is THE logging facade for .NET
Steven
+4  A: 

Take a look at Castle.Services.Logging.

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

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

Mauricio Scheffer
+3  A: 

I'm incorporating Simple Logging Facade because it appears to support The Object Guy's Logging Framework for .Net out of the box.

qstarin