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:29

I am using NLog from years with success and it is very well done project.

查看更多
Viruses.
3楼-- · 2019-03-10 15:33

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:

  • Essential Diagnostics - Extends the inbuilt features of System.Diagnostics namespace to provide flexible logging
  • NLog - NLog - Advanced .NET and Silverlight logging
  • Logazmic - Open source NLog viewer for Windows
  • ELMAH - Official ELMAH site
  • Elmah MVC - Elmah for MVC
  • Logary - Logary is a high performance, multi-target logging, metric, tracing and health-check library for Mono and .NET. .NET's answer to DropWizard. Supports many targets, built for micro-services.
  • Log4Net - The Apache log4net library is a tool to help the programmer output log statements to a variety of output targets
  • com.csutil.Log - A lightweight zero config Log wrapper that can be combined with other logging libraries like Serilog for more complex usecases.
  • Serilog - A no-nonsense logging library for the NoSQL era. Combines the best of traditional and structured diagnostic logging in an easy-to-use package.
  • StackExchange.Exceptional - Error handler used for the Stack Exchange network
  • Semantic Logging Application Block (SLAB) - Extends the inbuilt features of System.Diagnostics.Tracing namespace (EventSource class) to log to several sinks including Azure Tables, Databases, files (JSON, XML, text). Supports in-process and out-of-process logging through ETW, and Rx for real-time filtering/aggregating of events.
  • Foundatio - A fluent logging API that can be used to log messages throughout your application.
  • Exceptionless - Exceptionless .NET Client
  • Loupe - Centralized .NET logging and monitoring. [Proprietary] [Free Tier]
  • elmah.io - Cloud logging for .NET web applications using ELMAH. Find bugs before you go live. Powerful search, API, integration with Slack, GitHub, Visual Studio and more. [Free for OSS] [$]
  • BugSnag - Logs errors. Includes useful diagnostic info like stack trace, session, release, etc. Has a free tier. [Free for OSS][$]
查看更多
Fickle 薄情
4楼-- · 2019-03-10 15:34

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.

查看更多
闹够了就滚
5楼-- · 2019-03-10 15:38

Have used NLog successfully in numerous projects.

查看更多
趁早两清
6楼-- · 2019-03-10 15:44

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.

查看更多
叼着烟拽天下
7楼-- · 2019-03-10 15:45

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.

查看更多
登录 后发表回答