Configuring logging
In previous versions of ASP.NET Core (pre-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 were moved to default WebHostBuilder
, which is called in Program.cs
. Also, logging was moved to 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 the ASP.NET web stuff. We'll learn a lot more about IHostBuilder
later on in the following chapters. 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(args).Build(...