What's the most widely-used logging framework

2019-03-10 14:57发布

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?

标签: c# logging
7条回答
时光不老,我们不散
2楼-- · 2019-03-10 15:54

log4net is almost certainly the most common.

But I use Common.Logging - http://netcommon.sourceforge.net/ as it gives me flexibility

There are a variety of logging implementations for .NET currently in use, log4net, Enterprise Library Logging, NLog, to name the most popular. The downside of having differerent implementation is that they do not share a common interface and therefore impose a particular logging implementation on the users of your library.

Common.Logging library introduces a simple abstraction to allow you to select a specific logging implementation at runtime. Thus you can defer the decision what particular logging library to use until deployment. Adapters are used for plugging a particular logging system into Common.Logging.

查看更多
登录 后发表回答