title: netcore not logging to console
body: <p>I have a simple test project to experiment with logging with NetCore 2.0 using the Microsoft Logging Extensions package.</p>
  
  <p>The problem I'm having is that when I run my app the very first time, it logs informational messages as expected. The weird behavior I'm having though is that subsequent runs won't produce any messages at all.</p>
  
  <p>My project targets the Net Core 2.0 framework, and has the following NuGet packages installed:</p>
  
  <ul>
  <li>Microsoft.Extensions.Logging</li>
  <li>Microsoft.Extensions.Logging.Abstractions</li>
  <li>Microsoft.Extensions.Logging.Console</li>
  <li>Microsoft.Extensions.Logging.Debug</li>
  </ul>
  
  <p>Below is my sample code I'm trying to get logging working with:</p>
  
  <pre><code>using System;
  
  namespace LoggingNetCore2
  {
      using Microsoft.Extensions.Logging;
  
      class Program
      {
          static void Main(string[] args)
          {
              var loggerFactory = new LoggerFactory();
              loggerFactory.AddConsole();
              loggerFactory.AddDebug(); // &lt;-- why is this needed for console logging?
  
              var logger = loggerFactory.CreateLogger(typeof(Program));
              logger.LogInformation("Hello, World!");
              logger.LogTrace("trace");
              logger.LogDebug("debug");
              logger.LogWarning("warning");
              logger.LogCritical("critical");
              logger.LogError("errrrr");
  
              //using (logger.BeginScope("MyMessages"))
              //{
              //    logger.LogInformation("Beginning Operation...");
              //    logger.LogInformation("Doing something cool... please wait.");
              //    logger.LogInformation("Completed successfully.");
              //}
          }
      }
  }
  </code></pre>
  
  <p>I get no output on the console window when I run the above. Any ideas that spring to mind on what could be going on?</p>
  
  <p>Things I've tried:</p>
  
  <ul>
  <li>Added the <em>Microsoft.Extensions.Logging.Abstractions</em> package, as I vaguely remember needing to do that in NetCore 1.0 apps in the past.</li>
  <li>Uninstalled / reinstalled the above packages.</li>
  <li>I've even tried running the app from the command line via the dotnet.exe command, but to no avail.</li>
  <li>If I downgrade to NetCore framework 1.1 (and the NuGet packages to the 1.1 versions), things work as expected.</li>
  </ul>
  
  <p><strong>Edit:</strong> I got logs showing now in the console window if I add the debug logging provider into the mix.</p>
  
  <p>In a NetCore 1.x app, simply adding the console provider was enough.</p>
  
  <p><strong>Edit #2:</strong> Turns out the console logging provider doesn't immediately flush the messages to the console like it did in the net-core-1.x versions. It appears to run on a different thread. See this web page for info: <a href="https://github.com/aspnet/Logging/issues/631" rel="noreferrer">https://github.com/aspnet/Logging/issues/631</a></p>