replace loggerFactory.AddConsole(); with loggerBuilder.AddConsole();

This commit is contained in:
Igor_Sychev 2019-02-26 22:29:20 +03:00
parent 185a5dcc31
commit 5b36a89772
2 changed files with 6 additions and 2 deletions

View File

@ -21,6 +21,12 @@ namespace Ordering.SignalrHub
public static IWebHost BuildWebHost(string[] args) => public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args) WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
})
.UseSerilog((builderContext, config) => .UseSerilog((builderContext, config) =>
{ {
config config

View File

@ -120,8 +120,6 @@ namespace Ordering.SignalrHub
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, ILoggingBuilder loggerBuilder) public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, ILoggingBuilder loggerBuilder)
{ {
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerBuilder.AddDebug();
loggerBuilder.AddAzureWebAppDiagnostics(); loggerBuilder.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace); loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);