views:

477

answers:

9

Hi Experts,

I am trying to evaluate some of the best log utilities available for .NET framework, such as Microsoft Enterprise Library, Log4Net, elmah.

Can someone who has already gone through this exercise would come to my help in listing pros and cons of the best available in the market.

Thanks & Regards, Rajeev Ranjan Lall

+2  A: 

elmah is the best. elmah rocks!

this. __curious_geek
@this. __curious_geek: Is elmah for Windows application also?
Rajeev Ranjan Lall
No. Elmah uses specific ASP.NET platform capabilities (handlers).
Peter Stegnar
ELMAH is pretty easy to work with and it is pretty simple to use it with in a windows application. Only downside is that you lose the nice HTTPModule that it comes with but thankfully there a codeplex project that helps to aggregate such. http://aspexceptionreporter.codeplex.com/
JamesEggers
+5  A: 

In general good one is Log4net.

PROS: Log4Net supports many output sources.
CONS: Sometimes can slow your application.

For ASP.NET application is of the best ELMAH.

PROS: You do not have to change an application code a bit to use Elmah. You have to just include in you application.
CONS: Not that I know.

Peter Stegnar
Log4net is only slow on how you implement and what classes you attach it with.
Aim Kai
+1 for ELMAH. I've used ELMAH for years and it's great. I started about a year ago using ELMAH for manually error logging for non-web apps. I had to update the code slightly to allow me to pass the application name into it but then it worked well.
JamesEggers
+1  A: 

Enterprise Library is the only formal edition I have experience with, and our team found it too cumbersome and lacking in versatility for prime-time. You can safely avoid it and would likely end up better off coding your own solution instead.

I haven't had the opportunity to use either Log4Net or Elmah.

Hardryv
+1  A: 

I used to use my own custom, entlib, log4net and then Elmah

For asp.net error reporting Elmah is head and shoulders above the rest. However a couple of things I would like to see improved is the filtering and maybe a daily digest of email rather than one email per error.

If you want to inject logging, warns, debugs, traces etc then I would opt for log4net.

However it depends on the type of logging you are after...

Rippo
Rippo, elaborate on that please because I'm confident RRL would appreciate it -- it would surely help us on our corporate project as well (we're on the verge of yet another manually-programmed solution). The additional feedback could prove invaluable.
Hardryv
Which bit would you like me to elaborate on?
Rippo
On (iyho) what precisely about the error reporting makes Elmah head and shoulders above the competition, does it do the job differently? faster? with more grace? etc.
Hardryv
Have you used it? It no then I suggest you have a look, if yes then maybe you don't need to ask this. If you want to discuss this further then I suggest you ask about the differences as a new Stack Overflow question. HTH.
Rippo
+3  A: 

I have also heard good things about NLog although I haven't tested yet. They say the API is similar to the one provided by log4net.

Also, looking through SO you have a lot of questions related with this issue:

http://stackoverflow.com/questions/98080/what-is-the-best-logging-solution-for-a-c-net-3-5-project

http://stackoverflow.com/questions/185542/net-logging-framework

http://stackoverflow.com/questions/147557/error-logging-in-c

Hope this helps.

yeyeyerman
+3  A: 

Take a look at my logging framework. Easy to use. Easy to configure. Easy to extend.

And listen to what this guy says.

TheObjectGuy
A: 

Check out Gibraltar for great logging plus a lot more.

It has it's own logging API and we also have adapters for log4net, NLog, and the Object Guy's logging framework (PostSharp too!). Besides logging, Gibraltar also collects errors like ELMAH as well as collecting additional metrics useful for customer support or CEIP.

Jay Cincotta
A: 

log4net for Windows Forms, log4net and ELMAH for ASP.NET.

ELMAH and log4net have different purposes. ELMAH captures data regarding unhandled exceptions whereas log4net provides a logging framework at configurable levels (INFO, WARN, DEBUG, FATAL). log4net requires that you actively write logging statements in your code; ELMAH works automatically once properly configured.

Jamie Ide
A: 

Haven't seen this mentioned yet, but I've found that the built-in System.Diagnostics TraceSource and TraceListeners are very powerful for logging. We've built a number of high-performance custom TraceListeners for different data sources we persist logs to.

We swap in and out different listeners in the config file all the time. We take advantage of System.Diagnostics.CorrelationManager to walk chain of execution through many servers, processes and threads via logs.

All in all we have a sophisticated logging solution built on top of what came with the framework, and I'm very happy with it.

jsw