Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Exceptionless distributed Log Collection Framework in .NET Core

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you how to use the Exceptionless distributed log collection framework in .NET Core. The content is concise and easy to understand. I hope you can get something through the detailed introduction of this article.

I. introduction to Exceptionless

Exceptionless is an open source real-time log collection framework, which can be used in applications based on technology stacks such as ASP.NET,ASP.NET Core,Web Api,Web Forms,WPF,Console,MVC, and provides a Rest interface that can be applied in Javascript,Node.js. It makes log collection easy to use and does not need to know too many technical details and configuration.

In the past, we mostly used frameworks such as Log4net,Nlog to collect logs. When the application becomes complex and clustered, the traditional approach may not be very suitable, because collecting logs and analyzing them will become troublesome and a waste of time.

Now the Exceptionless team has provided us with a better framework to do this, which I think is great and meaningful, thanks to them.

two。 Use

There are two ways (local, remote)

Certain environmental requirements are required locally (NET 4.6.1, Java JDK 1.8 +, IIS Express 8 +)

Remote is more convenient, very convenient, so today to give you a wave of Exceptionless remote use of tutorials.

three。 Register an account and configure

Official website: http://exceptionless.com

GitHub: https://github.com/exceptionless/Exceptionless

With regard to the slow access to the official home page, there is no way, it is best to turn a ladder, of course, the home page is a bit slow, because the home page has Google's api, the management page is not so 36ms.

Because of the remote log we use, we have to enter the official application account and register with the official account.

Enter to create a project, enter project information, and create a project!

Of course you can choose our favorite .NET Core here! The official has told you that your project can be logged with Exceptionless at this time. Why don't we create a .NET Core program?

four。 Record remotely in a program

Nuget after Exceptionless.AspNetCore will appear a txt file, this txt file is for you to use a simple tutorial, of course, you can choose to delete.

Configure middleware

Public void Configure (IApplicationBuilder app, IHostingEnvironment env) {app.UseExceptionless ("xxxxxxxxxxxxxx"); app.UseMvc ();}

You can use it normally at this time, so now we deliberately make a mistake!

Public ActionResult Get () {throw new Exception ("my text info"); return new string [] {"value1", "value2"};}

Now launch our browser and report the error successfully.

So have we collected it in our framework? Scrub it and record it successfully.

So what information does it collect for us? Let's find out! Click in! I found it was really great.

In addition to recording some basic http information, there are also system version, system architecture, computer version, runtime and so on. It's often NB.

Of course, it is wrong for us to report an error maliciously, you can trycath it, and the code will become like this.

In addition to some exception records, ExceptionLess also provides Log (log), Feature Usages (functional purpose), 404, and Custom Event (custom events). The extension is in the ExceptionlessClient.Default class. You can study it if you are interested.

Attached log record encapsulation class (very simple one). Boss, don't hit me.

The above is how to use the Exceptionless distributed log collection framework in .NET Core. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report