Anyone have experience for both? How do they stack up against each other?
We are planning on using one of them for logging in an enterprise application.
References:
EDIT: We have no existing dependencies to either nlog or log4net.
Anyone have experience for both? How do they stack up against each other?
We are planning on using one of them for logging in an enterprise application.
References:
EDIT: We have no existing dependencies to either nlog or log4net.
I was recently tasked to "prototype up some loggin'" for an upcoming project. I didn't have any logging framework experience. I researched, ran through tutorials, made toy apps, etc. on Log4Net, NLog, and Enterprise Library for a few days. Came back 3-4 weeks later and put them together into a cohesive demo. Hopefully some of this is useful to you.
My recommendation for our project is this:
That's based on these findings (opinions!):
So obviously I like NLog so far. Not enough to use it in spite of having another solution available, though.
First look at the rest of your stack.
If you are using NHibernate, it utilizes Log4Net directly. Other frameworks might have other specific loggers they need.
Other than that: both work fine.
I've settled on Log4Net myself. It can be a pain to configure, and if it isn't configured correctly it is a pain to figure out what went wrong. But you can make it do almost anything you would want from a logger.
If you don't have a standing issue with Log4Net, here is an article I wrote on how to get started with it: http://elegantcode.com/2007/12/07/getting-started-with-log4net/
I second NLog too because it works with unmanaged code too. I suppose it could be possibe to use log4net and log4cxx together, but NLog handles both managed and unmanaged code out of the box.
I also looked at Common.Logging, a facade that makes abstraction of the logging api, it supports log4net, NLog and Entreprise Library. I don't think i'll use it, but i like how they use lambdas to improve performance when logging is disabled (a feature shared with NLog and probably others).
I think the general consensus is that nlog is a bit easier to configure and use. Both are quite capable, though.