ABP vNext 使用 logdashboard
Logdashboard可以直接在基于abp应用程序中安装使用
本文假设你了解ABP,并不对其做详细解释
使用
abp cli
创建项目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();
Install-Package LogDashboard
打开
BootStoreWebModule
类在
ConfigureServices
方法末尾添加以下代码context.Services.AddLogDashboard(opt => opt.SetRootPath(hostingEnvironment.ContentRootPath));
在
OnApplicationInitialization
方法末尾添加以下代码app.UseLogDashboard();
迁移后运行项目,导航到
/logdashboard
enjoy
Last modified 3yr ago