Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use the log panel in AspNetMvc. Logdashboard 1.1beta

Shulou Source: shulou.com Published: 2022-06-02 00:34:00 10月02日 Update

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.

Tags: Log support panel project query configuration more version example middleware source code knowledge article trend trend chart trend face practical unit hour Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Technology Redmi NVidia MariaDB