ABP vNext中使用开源日志面板 LogDashboard
ABP vNext 使用 logdashboard
本文示例源碼:
https://github.com/liangshiw/LogDashboard/tree/master/samples/abpvnext
ABP
ABP是aspnetcore3.0的開源web應(yīng)用程序框架,非常適合現(xiàn)代web應(yīng)用程序。有關(guān)ABP的更多內(nèi)容可以查看官方文檔
Logdashboard可以直接在基于abp應(yīng)用程序中安裝使用,關(guān)于Logdashboard的更多內(nèi)容可以查看ASPNETCore開源日志面板 :LogDashboard
示例
本文假設(shè)你了解ABP,并不對其做詳細(xì)解釋
使用?abp cli?創(chuàng)建項(xiàng)目
abp new BootStore使用以下代碼覆蓋Program?中的Serilog配置
Log.Logger = new LoggerConfiguration()#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.log", outputTemplate: "{Timestamp:HH:mm} || {Level} || {SourceContext:l} || {Message} || {Exception} ||end {NewLine}"))
.CreateLogger();
安裝LogDashboard
Install-Package LogDashboard打開?BootStoreWebModule?類
在ConfigureServices?方法末尾添加以下代碼
context.Services.AddLogDashboard(opt => opt.SetRootPath(hostingEnvironment.ContentRootPath));在OnApplicationInitialization?方法末尾添加以下代碼
app.UseLogDashboard();遷移后運(yùn)行項(xiàng)目,導(dǎo)航到/logdashboard
enjoy
原文鏈接:https://www.cnblogs.com/LiangSW/p/11933311.html
.NET社區(qū)新聞,深度好文,歡迎訪問公眾號文章匯總?http://www.csharpkit.com?
總結(jié)
以上是生活随笔為你收集整理的ABP vNext中使用开源日志面板 LogDashboard的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [原]排错实战——使用process e
- 下一篇: GitHub Actions,卧槽!牛批