title: .net core console application logging filter via appsetting.json
body: <p>I am trying to setup logging for my .net core console app. I am hoping to control the logging filter option using <code>appsetting.json</code>. It is not working, but not sure why. Here are the project setting.</p>
  <pre class="lang-xml prettyprint-override"><code>    &lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;
      
        &lt;PropertyGroup&gt;
          &lt;OutputType&gt;Exe&lt;/OutputType&gt;
          &lt;TargetFramework&gt;netcoreapp3.1&lt;/TargetFramework&gt;
        &lt;/PropertyGroup&gt;
      
        &lt;ItemGroup&gt;
          &lt;PackageReference Include=&quot;Microsoft.Extensions.Configuration&quot; Version=&quot;5.0.0&quot; /&gt;
          &lt;PackageReference Include=&quot;Microsoft.Extensions.Configuration.Binder&quot; Version=&quot;5.0.0&quot; /&gt;
          &lt;PackageReference Include=&quot;Microsoft.Extensions.Configuration.Json&quot; Version=&quot;5.0.0&quot; /&gt;
          &lt;PackageReference Include=&quot;Microsoft.Extensions.DependencyInjection&quot; Version=&quot;5.0.1&quot; /&gt;
          &lt;PackageReference Include=&quot;Microsoft.Extensions.Logging&quot; Version=&quot;5.0.0&quot; /&gt;
          &lt;PackageReference Include=&quot;Microsoft.Extensions.Logging.Console&quot; Version=&quot;5.0.0&quot; /&gt;
          &lt;PackageReference Include=&quot;Microsoft.Extensions.Logging.Debug&quot; Version=&quot;5.0.0&quot; /&gt;
        &lt;/ItemGroup&gt;
      
        &lt;ItemGroup&gt;
          &lt;None Update=&quot;appsettings.json&quot;&gt;
            &lt;CopyToOutputDirectory&gt;Always&lt;/CopyToOutputDirectory&gt;
          &lt;/None&gt;
        &lt;/ItemGroup&gt;
      
      &lt;/Project&gt;
  </code></pre>
  <p>appsetting.json</p>
  <pre class="lang-json prettyprint-override"><code>    {
        &quot;Logging&quot;: {
          &quot;LogLevel&quot;: {
            &quot;Default&quot;: &quot;Debug&quot;,
            &quot;System&quot;: &quot;Information&quot;,
            &quot;Microsoft&quot;: &quot;Debug&quot;
          },
          &quot;Console&quot;: {
            &quot;IncludeScopes&quot;: &quot;true&quot;
          }
        }
      }
  </code></pre>
  <p>Program.cs</p>
  <pre class="lang-cs prettyprint-override"><code>    using FlaggerDocUpload;
      using Microsoft.Extensions.Configuration;
      using Microsoft.Extensions.DependencyInjection;
      using Microsoft.Extensions.Logging;
      using System;
      using System.IO;
      
      namespace ConsoleApp1
      {
          class Program
          {
              static void Main(string[] args)
              {
                  IServiceCollection services = ConfigureServices();
                  var servicesProvider = services.BuildServiceProvider();
      
                  servicesProvider.GetService&lt;App&gt;().Run(args);
              }
      
              private static IServiceCollection ConfigureServices()
              {
                  IServiceCollection services = new ServiceCollection();
      
                  var config = LoadConfiguraton();
      
                  services.AddSingleton(config);
      
                  var v = config.GetSection(&quot;Logging&quot;);
                  services.AddLogging(configure =&gt; {
                      configure
                          .AddConfiguration(v)
                          .AddConsole()
                          .AddDebug();
                      });
                  services.AddTransient&lt;App&gt;();
      
                  return services;
                  
              }
      
              public static IConfiguration LoadConfiguraton()
              {
                  return new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile(&quot;appsetting.json&quot;, optional: true, reloadOnChange: true)
                          .Build();
              }
          }
      }
  </code></pre>
  <p>app.cs</p>
  <pre class="lang-cs prettyprint-override"><code>    using Microsoft.Extensions.Logging;
      using System;
      using System.Collections.Generic;
      using System.Text;
      
      namespace FlaggerDocUpload
      {
          class App
          {
              private readonly ILogger&lt;App&gt; logger;
      
              public App(ILogger&lt;App&gt; logger)
              {
                  this.logger = logger;
              }
      
              public void Run(string[] args)
              {
                  this.logger.LogInformation(&quot;hello Info&quot;);
                  this.logger.LogWarning(&quot;hello Warning&quot;);
                  this.logger.LogCritical(&quot;hello Critical&quot;);
                  this.logger.LogDebug(&quot;hello Debug&quot;);
                  this.logger.LogTrace(&quot;hello Trace&quot;);
                  this.logger.LogError(&quot;hello Error&quot;);
                  Console.WriteLine(&quot;Hello from APP&quot;);
      
                  Console.WriteLine(&quot;Hello World!&quot;);
                  foreach (string arg in args)
                      Console.WriteLine(arg);
      
                  Console.WriteLine(args.Length);
              }
          }
      }
  </code></pre>
  <p>It does not matter whatever I set in the appsetting.js the output is remain same. in the console. Any help will be much appreciated.</p>