title: Serilog in .Net: Adding custom enricher via appSettings.json doesn't work
body: <p>Using serilog, I'm trying to add custom enricher of my own via appSettings.json without success.</p>
  <p>I went exactly by the book, following the documentation.
  I also followed non official introduction like this <a href="https://www.ctrlaltdan.com/2018/08/14/custom-serilog-enrichers/" rel="nofollow noreferrer">https://www.ctrlaltdan.com/2018/08/14/custom-serilog-enrichers/</a></p>
  <p>The introduction above work fine with nuggets enrichers (like Serilog.Enrichers.Environment, Serilog.Enrichers.Thread and so on)
  but doesn't work with my custom enricher.
  Here is the relevant  code:</p>
  <pre><code>public class ClassNameEnricher: ILogEventEnricher
  {
      private string GetClassName()
      {
          StackTrace trace = new StackTrace();
          bool foundFrame = false;
          int currentFrame = 0;
          while (!foundFrame)
          {
              if (trace.GetFrame(currentFrame).GetMethod().ReflectedType.FullName == typeof(Logger).FullName)
              {
                  foundFrame = true;
              }
  
              currentFrame++;
          }
  
          return trace.GetFrame(currentFrame).GetMethod().ReflectedType.FullName;
      }
  
      public virtual void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
      {
          LogEventProperty className = propertyFactory.CreateProperty(&quot;ClassName&quot;, GetClassName());
          logEvent.AddPropertyIfAbsent(className);
      }
  }
  
  
  public static class LoggerEnrichmentConfigurationExtensions
  {
      public static LoggerConfiguration WithClassName(this LoggerEnrichmentConfiguration enrich)
      {
          return enrich.With&lt;ClassNameEnricher&gt;();
      }
  }
  </code></pre>
  <p>and the settings:</p>
  <p><a href="https://i.stack.imgur.com/vDCaa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vDCaa.png" alt="enter image description here" /></a></p>
  <p>I'll note that adding my enrihcer in code working fine.
  Any suggestion?</p>