Move generic webhost log output, enable in templates (#6814)
This commit is contained in:
parent
3dbf5d28fe
commit
9c017cd805
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
|||
{
|
||||
public GenericWebHostService(IOptions<GenericWebHostServiceOptions> options,
|
||||
IServer server,
|
||||
ILogger<GenericWebHostService> logger,
|
||||
ILoggerFactory loggerFactory,
|
||||
DiagnosticListener diagnosticListener,
|
||||
IHttpContextFactory httpContextFactory,
|
||||
IApplicationBuilderFactory applicationBuilderFactory,
|
||||
|
|
@ -37,7 +37,8 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
|||
{
|
||||
Options = options.Value;
|
||||
Server = server;
|
||||
Logger = logger;
|
||||
Logger = loggerFactory.CreateLogger<GenericWebHostService>();
|
||||
LifetimeLogger = loggerFactory.CreateLogger("Microsoft.Hosting.Lifetime");
|
||||
DiagnosticListener = diagnosticListener;
|
||||
HttpContextFactory = httpContextFactory;
|
||||
ApplicationBuilderFactory = applicationBuilderFactory;
|
||||
|
|
@ -49,6 +50,8 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
|||
public GenericWebHostServiceOptions Options { get; }
|
||||
public IServer Server { get; }
|
||||
public ILogger<GenericWebHostService> Logger { get; }
|
||||
// Only for high level lifetime events
|
||||
public ILogger LifetimeLogger { get; }
|
||||
public DiagnosticListener DiagnosticListener { get; }
|
||||
public IHttpContextFactory HttpContextFactory { get; }
|
||||
public IApplicationBuilderFactory ApplicationBuilderFactory { get; }
|
||||
|
|
@ -119,7 +122,7 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
|||
{
|
||||
foreach (var address in addresses)
|
||||
{
|
||||
Logger.LogInformation("Now listening on: {address}", address);
|
||||
LifetimeLogger.LogInformation("Now listening on: {address}", address);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -198,4 +201,4 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
"Default": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
"Default": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
"Default": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@
|
|||
//#endif
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
"Default": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@
|
|||
//#endif
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
"Default": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
"Default": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@
|
|||
//#endif
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
"Default": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
"Default": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
|
|
|||
Loading…
Reference in New Issue