【发布时间】:2016-12-06 20:32:20
【问题描述】:
我有使用 IdentityServer3 的 web asp.net MVC 应用程序。
我想将日志记录拆分到不同的接收器。
我想写IdentityServer3日志到Trace,EventLog("IdentityServer3")和SerilogWeb.Classic.Enrichers到数据库MSSqlServer。
我的配置是:
Log.Logger = new LoggerConfiguration()
.WriteTo.Trace()
.WriteTo.EventLog("IdentityServer3")
.Enrich.FromLogContext()
//all after this i want to write in database
.WriteTo.MSSqlServer("connectionString", "Log")
.Enrich.With(new HttpRequestIdEnricher())
.Enrich.With(new HttpRequestRawUrlEnricher())
.Enrich.With(new HttpRequestUserAgentEnricher())
.Enrich.With(new UserNameEnricher())
.CreateLogger();
【问题讨论】:
标签: c# asp.net .net logging serilog