title: Serilog dependency injection
body: <p>I am trying to dependency inject Serilog into all my projects in my WebAPI project in .Net Core 3.1.</p>
  <p>In my startup.cs, I am setting up the serilog, but possibly incorrectly:</p>
  <p>I have:
  <code>using Serilog;</code></p>
  <p>And then within:
  <code>public void ConfigureServices(IServiceCollection services)</code>, I have:</p>
  <p><code>services.AddSingleton(Log.Logger);</code></p>
  <p>I also have:</p>
  <pre><code>            var configuration = new ConfigurationBuilder()
                  .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile(&quot;appsettings.json&quot;)
                          .AddJsonFile($&quot;appsettings.Development.json&quot;, optional: true, reloadOnChange: true)
                          .Build();
  
              Log.Logger = new LoggerConfiguration()
                  .ReadFrom.Configuration(configuration)
                  .CreateLogger();
  </code></pre>
  <p>This, in my controller class, I do the usual:</p>
  <p><code>using Microsoft.Extensions.Logging;</code></p>
  <p><code>private readonly ILogger _log;</code></p>
  <pre><code>public AuthorisationController(IConfiguration config, ISecurityService securityService, ILogger&lt;AuthorisationController&gt; log)
          {
              Configuration = config;
              _securityService = securityService;
              _log = log;
          }
  </code></pre>
  <p>Config and SecurityService are OK.</p>
  <p>But in my first method, I try to log:</p>
  <p><code>_log.LogInformation(&quot;Login attempt&quot;);</code></p>
  <p>But nothing appears in my log.</p>
  <p>Can anyone spot the mistake?</p>
  <p>Not that it matters, but my appsettings has this:</p>
  <pre><code>    &quot;MinimumLevel&quot;: &quot;Debug&quot;,
      &quot;WriteTo&quot;: [
        {
          &quot;Name&quot;: &quot;Console&quot;,
          &quot;Args&quot;: {
            &quot;outputTemplate&quot;: &quot;===&gt; {Timestamp:HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}&quot;
          }
        },
        {
          &quot;Name&quot;: &quot;Loggly&quot;,
          &quot;Args&quot;: {
            &quot;customerToken&quot;: &quot;MySuperSecretKey&quot;
          }
        }
      ]
    }```
  
  </code></pre>