Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WebApplicationBuilder to read environment specific config for logging #32822

Closed
wants to merge 10 commits into from

Conversation

halter73
Copy link
Member

@halter73 halter73 commented May 18, 2021

Before

old-webapplicationbuilder-loggingconfiguration

After

new-webapplicationbuilder-loggingconfiguration

CreateDefaultBuilder/ConfigureWebHostDefaults

default-generic-host-loggingconfiguration

Fixes #32383

Thanks to @KevinCathcart for dotnet/runtime#51770 (comment)

TODO: Add tests

bootstrapBuilder.ConfigureWebHostDefaults(configure: _ => { });
bootstrapBuilder.ConfigureDefaults(args);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flipping the order of configuring WebHostDefaults was important for ensuring that the right appsettings.{Env}.json gets loaded initially when ASPNETCORE_ENVIRONMENT is configured. I don't know of any negative consequences of flipping the default configuration order for the BootstrapHostBuilder, but that doesn't mean there aren't any.

@halter73 halter73 marked this pull request as ready for review May 20, 2021 23:34
@halter73 halter73 closed this May 20, 2021
@amcasey amcasey added area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc and removed area-runtime labels Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-minimal-hosting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minimal host does not read environment specific configuration for logging
2 participants