Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enterprise Logging Block vs NLog vs log4net [closed]

I need to use a logging library in my project and considering between Enterprise Logging Block vs NLog vs log4net. I found some links on the comparison but most of those are quite old and complaint about things like no new versions of log4net for long etc.

Anyone has suggestion regarding which one is better in terms of ease of use, ease of configuration, performance, scalability etc based on current data.

like image 607
imak Avatar asked Feb 11 '11 16:02

imak


People also ask

Which is better NLog or log4net?

There is some small difference between NLog and log4net. NLog is easier to configure, and supports a much cleaner code-based configuration than log4net. I think the defaults in NLog are also more sensible than in log4net.

Which logging framework is best for .NET core?

NLog is one of the most popular, and one of the best-performing logging frameworks for . NET. Setting up NLog is fairly simple. Developers can use Nuget to download the dependency, then edit the NLog.

Which is better log4net or serilog?

Serilog has the concept of Sinks and log4net has appenders. They both cover the same need, just with different naming. Sinks and appenders are available for a lot of different destinations like files, databases, and remote services. As an example, elmah.io provides both a sink for Serilog and an appender for log4net.

Is serilog better than NLog?

Conclusion. From the results it is clear that even though both the Serilog log provider and the NLog log provider are similarly configured, the results for Serilog are much better than the ones for NLog in both throughput and latency.


Video Answer


5 Answers

I just evaluated log4net and NLog for usage in a bigger project. Both have a similar interface and are highly configurable.

NLog seems to be better maintained: An incompatibility of log4net with .Net4 remained unresolved in log4net for quite a long time. Nlog comes with some more 'bells and whistles' like a NuGet Package and a Xml Schema for Visual Studio for editing config files.

In the end we decided for log4net because we measured a much better performance for log4net: A simple test, writing 10000 log messages to a file and to a network log viewer (Log2Console) showed a ten times better performance of log4net! We did no tuning in the config file, file and notwork logger were used with a minimal configuration. You should verify this for yourself with a typical logging setup of your project.

like image 84
W.Gross Avatar answered Oct 04 '22 23:10

W.Gross


I personally like log4net. It's fast, stable and configurable (and it's really easy to extend with a custom appender or such).

I am not bothered by the lack of new releases - in my mind it just proves that the code base is stable and contains the features it should. After all, I want my logging to be stable above all.

Here is a slightly similar question, perhaps you can also use some of the answers from there.

like image 42
driis Avatar answered Oct 05 '22 00:10

driis


You can postpone the decision "which logger to use" if you are using Common.Logging . This is a logging wrapper where you can configure wether logging should go to log4net, nlog, System.Diagnostics.Debug. I donot know Enterprise Logging Block and i donot know if there is a "Enterprise Logging Block" plugin for common logging.

like image 34
k3b Avatar answered Oct 05 '22 00:10

k3b


Another difference that's often overlooked is that NLog is BSD while log4net is under Apache license. ELB is MS-PL (microsoft's open source version). That might not matter in most cases, just saying.

like image 20
nawfal Avatar answered Oct 04 '22 23:10

nawfal


I find them all to be quite similar and capable. It's been several years since I used the Enterprise Library Logging Block, but even back then it was decent. NLog & log4net are both solid.

One reason to choose one over another may be 3rd party library integration. If you are using NHibernate or Quartz or other libraries that utilize log4net, for example, it may drive your choice.

like image 22
quentin-starin Avatar answered Oct 05 '22 01:10

quentin-starin