2
我有使用IdentityServer3
的web asp.net MVC應用程序。 我想分割日誌到不同的接收器。 我想寫IdentityServer3
登錄到Trace
,EventLog("IdentityServer3")
和SerilogWeb.Classic.Enrichers
到數據庫MSSqlServer
。Serilog LoggerConfiguration通過上下文寫入不同的接收器
我的配置是:
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();