Wednesday, March 6, 2019

How to configure Event Log using IConfiguration?

I'm using Microsoft.Extensions.Logging, Microsoft.Extensions.Logging.Configuration and Microsoft.Extensions.Hosting along with related libraries. I am using generic host builder to build my host. I am configuring my logging using

hostBuilder.ConfigureLogging((hostContext, logBuilder) => { logBuilder.AddConfiguration(hostContext.Configuration.GetSection("Logging")) .AddConsole() .AddDebug() .AddEventLog(); }; 

I do not understand how I can configure EventLog using configuration. I checked the documentation but could not find anything useful. Where can I add event logging configuration and specify LogName and SourceName?

{ "Logging": { "LogLevel": { "Default": "Debug", "System": "Information", "Microsoft": "Information" }, "Console": { "IncludeScopes": true } } } 
How to configure Event Log using IConfiguration? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team