From dd7e8303718c36fcb4ae6bd22b0e8d6f5b50d53e Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Thu, 27 Apr 2017 14:38:55 -0700 Subject: [PATCH 1/9] don't build the whole repo when making the fallback archive --- build/repo.targets | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/repo.targets b/build/repo.targets index 50d976be53..ac13314b1c 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -9,7 +9,7 @@ $(RepositoryRoot)src\Archive.AspNetCore.All\ $(FallbackArchiveDir)Archive.AspNetCore.All.csproj - $(RepositoryRoot)src\dotnet-archive\dotnet-archive.csproj + $(RepositoryRoot)src\dotnet-archive\dotnet-archive.csproj $(RepositoryRoot)src\dotnet-archive\bin\$(Configuration)\netcoreapp2.0\dotnet-archive.dll $(MetaPackagePath)bin\work\ @@ -28,10 +28,6 @@ $(CompileDependsOn); BuildPackageCache - - $(CompileDependsOn); - BuildFallbackArchive - @@ -152,6 +148,10 @@ $(COHERENCE_SIGNED_DROP_LOCATION)\Signed\Packages + + + + From db314595510f181bbc5ee16b5efed3e6516d5e3d Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Thu, 27 Apr 2017 15:06:13 -0700 Subject: [PATCH 2/9] fix timestamps --- build/common.props | 9 +++------ build/repo.targets | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/build/common.props b/build/common.props index fcf40a899f..464cf34bdb 100644 --- a/build/common.props +++ b/build/common.props @@ -11,14 +11,11 @@ true true $(VersionSuffix) - - - $(VersionSuffix) - $(VersionSuffix)-$(BuildNumber) + $(VersionSuffix)-$(BuildNumber) - 2.0.0-$(BuildVersionSuffix) - 1.0.0-$(BuildVersionSuffix) + 2.0.0-$(VersionSuffix) + 1.0.0-$(VersionSuffix) diff --git a/build/repo.targets b/build/repo.targets index ac13314b1c..9888724625 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -141,8 +141,8 @@ $(TIMESTAMP_FREE_VERSION) final - $(VersionPrefix)-$(VersionSuffix)-$(NoTimestampSuffix) - $(VersionPrefix)-$(VersionSuffix)-$(BuildNumber) + $(VersionPrefix)-$(OriginalVersionSuffix)-$(NoTimestampSuffix) + $(VersionPrefix)-$(OriginalVersionSuffix)-$(BuildNumber) $(COHERENCE_SIGNED_DROP_LOCATION)\Signed\Packages-NoTimeStamp $(COHERENCE_SIGNED_DROP_LOCATION)\Signed\Packages From e225d23771ba5a06d062df4f74efee34a365b2f4 Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Thu, 27 Apr 2017 15:19:44 -0700 Subject: [PATCH 3/9] hack to unblock the build, also a good fix --- build/common.props | 2 +- src/dotnet-archive/dotnet-archive.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/common.props b/build/common.props index 464cf34bdb..30512a04d6 100644 --- a/build/common.props +++ b/build/common.props @@ -11,7 +11,7 @@ true true $(VersionSuffix) - $(VersionSuffix)-$(BuildNumber) + $(VersionSuffix)-$(BuildNumber) 2.0.0-$(VersionSuffix) diff --git a/src/dotnet-archive/dotnet-archive.csproj b/src/dotnet-archive/dotnet-archive.csproj index 67a2ef1a9b..1cecf05c95 100644 --- a/src/dotnet-archive/dotnet-archive.csproj +++ b/src/dotnet-archive/dotnet-archive.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0 + netcoreapp1.1 Exe false From ac508e9ef3771672b792d62da9358112043b30aa Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Thu, 27 Apr 2017 15:30:21 -0700 Subject: [PATCH 4/9] just package the archive separately --- build/repo.targets | 17 +++++------------ src/dotnet-archive/dotnet-archive.csproj | 3 ++- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/build/repo.targets b/build/repo.targets index 9888724625..1747f9d4de 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -9,8 +9,6 @@ $(RepositoryRoot)src\Archive.AspNetCore.All\ $(FallbackArchiveDir)Archive.AspNetCore.All.csproj - $(RepositoryRoot)src\dotnet-archive\dotnet-archive.csproj - $(RepositoryRoot)src\dotnet-archive\bin\$(Configuration)\netcoreapp2.0\dotnet-archive.dll $(MetaPackagePath)bin\work\ $(MetaPackagePath)bin\packageCache\ @@ -100,6 +98,8 @@ + + @@ -121,13 +121,10 @@ SourceName="Dependencies" SourceUri="$(PackageSource)" /> - - - - + @@ -148,15 +145,11 @@ $(COHERENCE_SIGNED_DROP_LOCATION)\Signed\Packages - - - - - - + + diff --git a/src/dotnet-archive/dotnet-archive.csproj b/src/dotnet-archive/dotnet-archive.csproj index 1cecf05c95..5ea7e8fb45 100644 --- a/src/dotnet-archive/dotnet-archive.csproj +++ b/src/dotnet-archive/dotnet-archive.csproj @@ -3,9 +3,10 @@ - netcoreapp1.1 + netcoreapp2.0 Exe false + win7-x64 From 09bf1affbd2417cb8e06ac6b7ba7abee9fe9e434 Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Thu, 27 Apr 2017 15:34:39 -0700 Subject: [PATCH 5/9] derped again --- build/repo.targets | 1 - 1 file changed, 1 deletion(-) diff --git a/build/repo.targets b/build/repo.targets index 1747f9d4de..c19ee3a5bb 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -122,7 +122,6 @@ SourceUri="$(PackageSource)" /> - From 77d9b16ad22df36be822b6ebd851871c4b560801 Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Thu, 27 Apr 2017 15:38:05 -0700 Subject: [PATCH 6/9] restore restoring of the archive project --- build/repo.targets | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/repo.targets b/build/repo.targets index c19ee3a5bb..d7ec150d6b 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -121,9 +121,12 @@ SourceName="Dependencies" SourceUri="$(PackageSource)" /> + + + - + From 8e597c5f80a8799fc0a0be197372a0f97cf4869a Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Thu, 27 Apr 2017 15:56:49 -0700 Subject: [PATCH 7/9] derped the file name --- build/repo.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/repo.targets b/build/repo.targets index d7ec150d6b..f7c618d778 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -157,7 +157,7 @@ $(PublishShare)\fallbackArchives - + From 70716bdff56cf2481cc50666d2a5c4183260b60a Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Thu, 27 Apr 2017 16:05:52 -0700 Subject: [PATCH 8/9] use actual set of packages (#78) --- NuGet.config | 1 + src/Archive.AspNetCore.All/Archive.AspNetCore.All.csproj | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/NuGet.config b/NuGet.config index fa4304af9c..8d4d39ddcc 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,6 +3,7 @@ + diff --git a/src/Archive.AspNetCore.All/Archive.AspNetCore.All.csproj b/src/Archive.AspNetCore.All/Archive.AspNetCore.All.csproj index 5d1de6a2bb..81a3815a0e 100644 --- a/src/Archive.AspNetCore.All/Archive.AspNetCore.All.csproj +++ b/src/Archive.AspNetCore.All/Archive.AspNetCore.All.csproj @@ -4,28 +4,22 @@ netcoreapp2.0 $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; false + netcoreapp2.0 - - - - - From 8102d6a038863ad2fc34d8c14bfb9aa535d26446 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Tue, 25 Apr 2017 15:07:10 -0700 Subject: [PATCH 9/9] Add configuration to logging in WebHost --- src/Microsoft.AspNetCore/WebHost.cs | 3 +- .../WebHostFunctionalTests.cs | 41 +++++++++++++++++++ .../CreateDefaultBuilderApp/Program.cs | 28 +------------ 3 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/Microsoft.AspNetCore/WebHost.cs b/src/Microsoft.AspNetCore/WebHost.cs index aea490fb7f..51b5a6e160 100644 --- a/src/Microsoft.AspNetCore/WebHost.cs +++ b/src/Microsoft.AspNetCore/WebHost.cs @@ -175,8 +175,9 @@ namespace Microsoft.AspNetCore config.AddCommandLine(args); } }) - .ConfigureLogging(logging => + .ConfigureLogging((hostingContext, logging) => { + logging.UseConfiguration(hostingContext.Configuration.GetSection("Logging")); logging.AddConsole(); logging.AddDebug(); }) diff --git a/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs b/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs index 99485cab7d..43be04f16e 100644 --- a/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs +++ b/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs @@ -200,6 +200,47 @@ namespace Microsoft.AspNetCore.Tests } } + [Fact] + public void LoggingConfigurationSectionPassedToLoggerByDefault() + { + try + { + File.WriteAllText("appsettings.json", @" +{ + ""Logging"": { + ""LogLevel"": { + ""Default"": ""Warning"" + } + } +} +"); + using (var webHost = WebHost.Start(context => context.Response.WriteAsync("Hello, World!"))) + { + var factory = (ILoggerFactory)webHost.Services.GetService(typeof(ILoggerFactory)); + var logger = factory.CreateLogger("Test"); + + logger.Log(LogLevel.Information, 0, "Message", null, (s, e) => + { + Assert.True(false); + return string.Empty; + }); + + var logWritten = false; + logger.Log(LogLevel.Warning, 0, "Message", null, (s, e) => + { + logWritten = true; + return string.Empty; + }); + + Assert.True(logWritten); + } + } + finally + { + File.Delete("appsettings.json"); + } + } + private async Task ExecuteStartOrStartWithTest(Func> getResponse, string applicationName) { await ExecuteTestApp(applicationName, async (deploymentResult, logger) => diff --git a/test/TestSites/CreateDefaultBuilderApp/Program.cs b/test/TestSites/CreateDefaultBuilderApp/Program.cs index f14aec8f93..eb7eeaaa03 100644 --- a/test/TestSites/CreateDefaultBuilderApp/Program.cs +++ b/test/TestSites/CreateDefaultBuilderApp/Program.cs @@ -24,7 +24,6 @@ namespace CreateDefaultBuilderApp string responseMessage = string.Empty; WebHost.CreateDefaultBuilder(new[] { "--cliKey", "cliValue" }) - .UseLoggerFactory(new TestLoggerFactory()) .ConfigureServices((context, services) => { responseMessage = GetResponseMessage(context, services); @@ -77,34 +76,11 @@ namespace CreateDefaultBuilderApp return $"Command line arguments not loaded into Configuration."; } - var testLoggerFactory = (TestLoggerFactory)context.LoggerFactory; - - // Verify AddConsole called - if (!testLoggerFactory.Providers.Any(provider => provider is ConsoleLoggerProvider)) - { - return $"Console logger not added to ILoggerFactory."; - } - - // Verify AddDebug called - if (!testLoggerFactory.Providers.Any(provider => provider is DebugLoggerProvider)) - { - return $"Debug logger not added to ILoggerFactory."; - } - + // TODO: Verify AddConsole called + // TODO: Verify AddDebug called // TODO: Verify UseIISIntegration called return context.HostingEnvironment.ApplicationName; } - - private class TestLoggerFactory : ILoggerFactory - { - public IList Providers { get; } = new List(); - - public void AddProvider(ILoggerProvider provider) => Providers.Add(provider); - - public ILogger CreateLogger(string categoryName) => NullLogger.Instance; - - public void Dispose() { } - } } } \ No newline at end of file