title: Configuring Serilog RollingFile with appsettings.json
body: <p>I'm trying to configure Serilog for a .NET Core project. Here's what I have in my <code>appsettings.json</code>:</p>
  <pre><code> &quot;Serilog&quot;: 
  {
      &quot;MinimumLevel&quot;: &quot;Verbose&quot;,
      &quot;Enrich&quot;: [&quot;FromLogContext&quot;, &quot;WithMachineName&quot;, &quot;WithProcessId&quot;, &quot;WithThreadId&quot;],
      &quot;WriteTo&quot;: [
        { &quot;Name&quot;: &quot;RollingFile&quot;,
          &quot;Args&quot;: {
            &quot;pathFormat&quot;: &quot;C:/Logfiles/testapp/log-{Date}.json&quot;,
            &quot;textFormatter&quot;: &quot;JsonFormatter&quot;,
            &quot;fileSizeLimitBytes&quot;: 2147483648,
            &quot;retainedFileCountLimit&quot;: 5
          }
        }
      ]
    }
  </code></pre>
  <p>The problem I see is that <code>JsonFormatter</code> is not picked up, and instead I get entries using the default text formatter. I tried using <code>&quot;formatter&quot;: &quot;JsonFormatter&quot;</code>, but got the same result.</p>
  <p>It all works fine if I configure Serilog in code:</p>
  <pre><code>var jsonSink = new RollingFileSink(config[&quot;Logger:FilePath&quot;], new JsonFormatter(), 2147483648, 5);
  
  var logger = new Serilog.LoggerConfiguration().WriteTo.Sink(jsonSink);
  </code></pre>
  <p>Here is the relevant section of my <code>project.json</code>:</p>
  <pre><code>&quot;Serilog&quot;: &quot;2.2.1&quot;,
  &quot;Serilog.Extensions.Logging&quot;: &quot;1.1.0&quot;,
  &quot;Serilog.Sinks.Literate&quot;: &quot;2.0.0&quot;,
  &quot;Serilog.Sinks.Seq&quot;: &quot;2.0.0&quot;,
  &quot;Microsoft.Extensions.Configuration.EnvironmentVariables&quot;: &quot;1.0.0&quot;,
  &quot;Microsoft.Extensions.Configuration.Json&quot;: &quot;1.0.0&quot;,
  &quot;Microsoft.Extensions.Configuration.UserSecrets&quot;: &quot;1.0.0&quot;,
  &quot;Microsoft.Extensions.Logging&quot;: &quot;1.0.0&quot;,
  &quot;Microsoft.Extensions.Logging.Console&quot;: &quot;1.0.0&quot;,
  &quot;Microsoft.Extensions.Logging.Debug&quot;: &quot;1.0.0&quot;,
  &quot;Microsoft.Extensions.Options.ConfigurationExtensions&quot;: &quot;1.0.0&quot;,
  &quot;Serilog.Enrichers.Thread&quot;: &quot;2.0.0&quot;,
  &quot;Serilog.Enrichers.Process&quot;: &quot;2.0.0&quot;,
  &quot;Serilog.Sinks.ColoredConsole&quot;: &quot;2.0.0&quot;,
  &quot;Serilog.Settings.Configuration&quot;: &quot;2.2.0&quot;
  </code></pre>