views:

140

answers:

5

What logger library you use in .NET projects and the one you prefer? I used log4net for a while, but it's last version is 2007. What is your personal choice and your opinion if you had hands on several libraries? Is there a logger library that is production standard nowadays?

Thank you in advance!

+2  A: 

I personally can't stand log4net. If you use a log4j, then maybe it makes sense, but if you're starting from an uncorrupted mind, you're going to wonder why it's written the way it is.

I prefer The Object Guy's Dot Net Logger.

Alan
+2  A: 

Logging Application Block from Microsoft Enterprise Library is not bad one.

List of advantages:

  1. It can write to the various predefined destinations - database, Event log, Text file, Remote server by MSMQ and It also supports custom writers.
  2. Configuration can be done trough external tool, which works directly with your application app.config or dynamically in runtime.
  3. Support from Microsoft. 5 version released on April 2010
Yauheni Sivukha
I agree. I especially like the extensibility. One nice feature that I have added to Logging Block is the ability to email to a group of stake holders based on certain message categories.
Syd
Thank you for the reference! Current version is 5.0 and finally it reached log4net capabilities.
Andrew Florko
+1  A: 

I prefer my own CuttingEdge.Logging. I built it, because I was a bit annoyed with the complexity logging frameworks such as Log4net and Logging Application Block. CuttingEdge.Logging is easy to use, but sacrifices flexibility for this.

Steven
+1 I prefer to "roll my own" for basic systems, and use a more complex implementation for larger systems
RobS
@RobS: Thanks for the up vote. I wouldn't advice anyone to roll their own logging framework. Even for basic systems. There are enough frameworks to pick from (such as my own). Of course the problem becomes picking the right one. When you're in doubt, you can always use a logging facade and pick a framework that has an implementation for that facade. CuttingEdge.Logging for instance, has an adapter for the Common.Logging infrastructure.
Steven
+4  A: 

I still use log4net. No complaints.

Ron Klein
+1 My only complaint is the slightly annoying API differences when logging a formatted message. eg. `log.Debug` versus `log.DebugFormat` instead of just overloading `log.Debug`.
Kent Boogaart
A: 

Two that I know of are log4net. I've used this on numerous projects. The documentation is decent although I always have to read the docs to get a new project set up.

There is also NLog although I haven't used it.

Jeremy Wiebe