I'm looking into how to implement logging in my C# app - its a DLL class library. What logging frameworks are most widely used - what would give users of my DLL the most flexibility and configurability? Is there a C# equivalent of log4j?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
I am using NLog from years with success and it is very well done project.
2009 Answer: Equivalent of log4j for .NET platform is log4net and I am guessing it's widely used.
2019 Answer: Here are a variety of alternatives from https://github.com/quozd/awesome-dotnet/blob/master/README.md#logging:
Enterprise Library. It's robust and comes straight from Microsoft with all their best practices included. We use it in all our projects. It's very flexible and there is a UI tool that you can use in case you don't want to mess around with managing logging from the config file.
Have used NLog successfully in numerous projects.
We use our own logging classes, implemented by calling log4net. This allows us to take advantage of this flexible and widely-used framework while avoiding thousands of direct references to it in the source code.
People have been using Enterprise Library extensively. But it may be true that developers are switching to other products these days.
I'd check it out and see if it has the necessary functionality you need and not too much bloat.