Configuring logging
In previous versions of ASP.NET Core (that is, before version 2.0), logging was configured in Startup.cs
. As a reminder, since version 2.0, the Startup.cs
file has been simplified, and a lot of configurations have been moved to the default WebHostBuilder
, which is called in Program.cs
. Also, logging was moved to the default WebHostBuilder
.
In ASP.NET Core 3.1 and later versions, the Program.cs
file gets more generic, and IHostBuilder
will be created first. IHostBuilder
is pretty useful for bootstrapping an application without all of the ASP.NET web stuff. We'll learn a lot more about IHostBuilder
later on in this book. With this IHostBuilder
, we create IWebHostBuilder
to configure ASP.NET Core. In ASP.NET Core 3.1 and later versions, we get IWebHostBuilder
with the webBuilder
variable:
public class Program { public static void Main(string[] args) { CreateHostBuilder...