title: ILoggerFactory vs serviceCollection.AddLogging vs WebHostBuilder.ConfigureLogging
body: <p>I have typical logging requirement for my asp.net core 2.x app: </p>
  
  <ul>
  <li>use application insight in production, </li>
  <li>console and debug logger in development env</li>
  <li>setup some filters based on category and log level</li>
  </ul>
  
  <p>Now I see at least three different API's to configure the logging:</p>
  
  <ol>
  <li><p><code>WebHostBuilder.ConfigureLogging()</code>in Program.cs</p>
  
  <pre><code>public static void Main(string[] args)
  {
      var webHost = new WebHostBuilder()               
          .ConfigureLogging((hostingContext, logging) =&gt;
          {
              logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
              logging.AddConsole();
              logging.AddDebug();
              logging.AddAzureWebAppDiagnostics();
          })
          .UseStartup&lt;Startup&gt;()
          .Build();
  
      webHost.Run();
  }
  </code></pre></li>
  <li><p>Inject <code>ILoggerFactory</code> to Startup.Configure method:</p>
  
  <pre><code>public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
  {
      loggerFactory.AddConsole();
      loggerFactory.AddAzureWebAppDiagnostics();
      loggerFactory.AddApplicationInsights(app.ApplicationServices, 
          (category, level) =&gt; level &gt;= (category == "Microsoft" ? LogLevel.Error : LogLevel.Information));
      }
  </code></pre></li>
  <li><p>in Startup.ConfigureServices:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddLogging(logging =&gt; 
      {
          logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
          logging.AddConsole();
          logging.AddDebug();
          logging.AddAzureWebAppDiagnostics();
      }
  }
  </code></pre></li>
  </ol>
  
  <p>What is the difference between those? When to use which?</p>