title: What is the preferred way to configure logging with Serilog in NetCore when using a generic Host?
body: <p>How should Serilog be configured if you want to use it within NetCore and a generic <code>Host</code> (or <code>IHost</code>), not a <code>WebHost</code> or something else?</p>
  <p>There are the two options I found:</p>
  <ol>
  <li>Use <code>.UseSerilog()</code> from the <code>Serilog.Extensions.Hosting</code> NuGet package:</li>
  </ol>
  <pre class="lang-cs prettyprint-override"><code>var host = Host.CreateDefaultBuilder()
                      .UseSerilog()
                      .UseSystemd()
                      .UseWindowsService()
                      .Build();
  </code></pre>
  <ol start="2">
  <li>Use <code>.ConfigureLogging()</code> and <code>.AddSerilog()</code> from the <code>Serilog</code> NuGet package:</li>
  </ol>
  <pre class="lang-cs prettyprint-override"><code>.ConfigureLogging(
      logging =&gt;
      {
          logging.AddSerilog();
      });
  </code></pre>
  <p>So there are two questions now:</p>
  <ol>
  <li>Do both options result in the same behaviour and if not, what's the difference?</li>
  <li>Which method should be used preferred (Or are they equal and you can use as you like)?</li>
  </ol>