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 the log panel in AspNetMvc. Logdashboard 1.1beta

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

Share

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

This article is about how to use the log panel in AspNetMvc. Logdashboard 1.1beta, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it with the editor.

Logdashboard is the log panel under Net, which supports AspNet and AspNetCore projects.

Just after LogDashboard released the beta version 1.1, there are the following changes in this version:

AspNetMvc projects that support NetFramework

Add more trends to the trend chart

Support for serilog logging components

Asynchronous query log

Using the Log Panel in AspNetMvc

Example source code: https://github.com/liangshiw/LogDashboard/tree/master/samples/NfxAspNetMvc

Create an AspNetMvc project using VisualStudio, named NfxAspNetMvc

Configure Nlog

Install Nlog.Web in the package management console

Install-Pakcage Nlog.Web

Add the following Nlog.config to the project and copy the configuration to the directory

Open WebConfig and copy the following modules node configuration to WebConfig

Open HomtController and use logger to write a log

Install LogDashboard

LogDashboard relies on Owin middleware in AspNetMvc. Let's install the Microsoft.Owin.Host.SystemWeb package first.

Install-Package Microsoft.Owin.Host.SystemWeb

To install LogDashboard, you need to specify a version at the time of installation because it is a pre-release version

Install-Package LogDashboard-Version 1.1.0-beta

Finally, we add the Owin Startup class, which appears when we search for owin, and configure the LogDashboard middleware in Startup.

When you run the project and navigate to / logdashboard, you will see the log panel with the log message HomeController index action that we added

Trend chart

Log trend charts in hours, days, weeks, and months have been added in 1.1.

Support for serilog

In addition to log4net and Nlog, LogDashboard also adds support and examples for serilog.

Example source code:

Https://github.com/liangshiw/LogDashboard/tree/master/samples/StructuredLog

You can download the experience by yourself.

Asynchronous query log

I fork https://github.com/tmsmith/Dapper-Extensions, add asynchronous query support for the NetStandard version, and release the Nuget package

Https://www.nuget.org/packages/DapperExtensions.Standard/

The asynchronous query of database is realized in LogDashboard.

This is how to use the log panel in AspNetMvc. Logdashboard 1.1beta, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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