Logdashboard是Net下的日志面板,它支持AspNet与AspNetCore项目。关于更多LogDashboard的介绍请看这里--使用logdashboard查看可视化日志

就在刚刚LogDashboard发布了1.1的beta版,在这个版本中有以下变化
https://github.com/liangshiw/LogDashboard/releases

  • 支持NetFramework的AspNetMvc项目

  • 走势图添加更多趋势

  • 支持serilog日志组件

  • 异步查询日志

在AspNetMvc中使用日志面板

示例源码 : https://github.com/liangshiw/LogDashboard/tree/master/samples/NfxAspNetMvc

使用VisualStudio创建一个AspNetMvc项目,命名为 NfxAspNetMvc

配置Nlog

在程序包管理控制台安装 Nlog.Web
Install-Pakcage Nlog.Web

将下面的Nlog.config添加到项目中,并且配置复制到目录

在AspNetMvc中使用日志面板. Logdashboard 1.1beta

打开WebConfig 将下面的modules节点配置复制到 WebConfig

在AspNetMvc中使用日志面板. Logdashboard 1.1beta

打开 HomtController 使用logger 写一条日志

在AspNetMvc中使用日志面板. Logdashboard 1.1beta

安装LogDashboard

logDashboard在AspNetMvc中依赖Owin中间件,首先我们先安装 Microsoft.Owin.Host.SystemWeb 包

Install-Package Microsoft.Owin.Host.SystemWeb

下面安装LogDashboard 因为是预发布版,在安装的时候需要指定版本

Install-Package LogDashboard -Version 1.1.0-beta

最后我们添加Owin Startup类,在添加时搜索owin会出现该条目,在Startup中配置LogDashboard中间件

在AspNetMvc中使用日志面板. Logdashboard 1.1beta

这时运行项目并导航到 /logdashboard 就会看到日志面板,与我们添加的日志消息 HomeController index action

在AspNetMvc中使用日志面板. Logdashboard 1.1beta

走势图

在1.1中添加了以小时、天、周、月为单位的日志趋势图

在AspNetMvc中使用日志面板. Logdashboard 1.1beta

支持serilog

除了log4net、Nlog之外 LogDashboard还加入了serilog的支持与示例

示例源码:

https://github.com/liangshiw/LogDashboard/tree/master/samples/StructuredLog
大家可以自行下载体验

异步查询日志

我fork了 https://github.com/tmsmith/Dapper-Extensions ,添加了NetStandard版本的异步查询支持,并发布了Nuget包

 https://www.nuget.org/packages/DapperExtensions.Standard/
在LogDashboard中实现了数据库的异步查询

原文地址:https://www.cnblogs.com/LiangSW/p/10310681.html



.NET社区新闻,深度好文,欢迎访问公众号文章汇总 http://www.csharpkit.com

在AspNetMvc中使用日志面板. Logdashboard 1.1beta


相关文章:

  • 2021-06-27
  • 2022-12-23
  • 2021-12-10
  • 2022-02-14
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
猜你喜欢
  • 2021-10-28
  • 2022-01-08
  • 2022-12-23
  • 2021-06-16
  • 2021-06-06
  • 2022-01-07
  • 2022-02-09
相关资源
相似解决方案