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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
||||||
{
|
{
|
||||||
public GenericWebHostService(IOptions<GenericWebHostServiceOptions> options,
|
public GenericWebHostService(IOptions<GenericWebHostServiceOptions> options,
|
||||||
IServer server,
|
IServer server,
|
||||||
ILogger<GenericWebHostService> logger,
|
ILoggerFactory loggerFactory,
|
||||||
DiagnosticListener diagnosticListener,
|
DiagnosticListener diagnosticListener,
|
||||||
IHttpContextFactory httpContextFactory,
|
IHttpContextFactory httpContextFactory,
|
||||||
IApplicationBuilderFactory applicationBuilderFactory,
|
IApplicationBuilderFactory applicationBuilderFactory,
|
||||||
|
|
@ -37,7 +37,8 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
||||||
{
|
{
|
||||||
Options = options.Value;
|
Options = options.Value;
|
||||||
Server = server;
|
Server = server;
|
||||||
Logger = logger;
|
Logger = loggerFactory.CreateLogger<GenericWebHostService>();
|
||||||
|
LifetimeLogger = loggerFactory.CreateLogger("Microsoft.Hosting.Lifetime");
|
||||||
DiagnosticListener = diagnosticListener;
|
DiagnosticListener = diagnosticListener;
|
||||||
HttpContextFactory = httpContextFactory;
|
HttpContextFactory = httpContextFactory;
|
||||||
ApplicationBuilderFactory = applicationBuilderFactory;
|
ApplicationBuilderFactory = applicationBuilderFactory;
|
||||||
|
|
@ -49,6 +50,8 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
||||||
public GenericWebHostServiceOptions Options { get; }
|
public GenericWebHostServiceOptions Options { get; }
|
||||||
public IServer Server { get; }
|
public IServer Server { get; }
|
||||||
public ILogger<GenericWebHostService> Logger { get; }
|
public ILogger<GenericWebHostService> Logger { get; }
|
||||||
|
// Only for high level lifetime events
|
||||||
|
public ILogger LifetimeLogger { get; }
|
||||||
public DiagnosticListener DiagnosticListener { get; }
|
public DiagnosticListener DiagnosticListener { get; }
|
||||||
public IHttpContextFactory HttpContextFactory { get; }
|
public IHttpContextFactory HttpContextFactory { get; }
|
||||||
public IApplicationBuilderFactory ApplicationBuilderFactory { get; }
|
public IApplicationBuilderFactory ApplicationBuilderFactory { get; }
|
||||||
|
|
@ -119,7 +122,7 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
||||||
{
|
{
|
||||||
foreach (var address in addresses)
|
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": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@
|
||||||
//#endif
|
//#endif
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@
|
||||||
//#endif
|
//#endif
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@
|
||||||
//#endif
|
//#endif
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue