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:
log4net
nlog
EDIT: We have no existing dependencies to either nlog or log4net.
Conclusion. Picking between Serilog and NLog is hard since both have a lot of features like structured logging and C# based configuration. We are using Serilog on elmah.io since we are logging to both elmah.io and Elasticsearch. Both sinks work great and are actively maintained.
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.
I do understand that NLog is not a port of Log4j. Still, depending on the type of application, NLog might accept user input and put it into a log file, possibly un-sanitized.
In fact, I can use Log4Net alongside the default logging API for . NET Core: Microsoft. Extensions. Logging.
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.
A key consideration that hasn't been much discussed is support and updates.
Log4Net hasn't been updated since version 1.2.10 was published April 19, 2006.
In contrast, NLog has been actively supported since 2006 will soon release NLog 2.0 supporting many platforms that didn't exist when log4net was last updated such as:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With