title: Serilog LogContext pushed properties not logged using Owin Middleware
body: <p>This is my <strong>Owin</strong> LoggingMiddlware</p>
  
  <pre><code>    public class LoggerMiddleware : OwinMiddleware
      {
          public LoggerMiddleware(OwinMiddleware next) : base(next)
          {
          }
  
          public override async Task Invoke(IOwinContext context)
          {
              string userName = "Anonymous";
              if (context.Authentication.User.Identity.IsAuthenticated)
                  userName = context.Authentication.User.Identity.Name;
              using (LogContext.Push(new PropertyEnricher("User", userName)))
              {
                  Log.Debug("LogContext impostato");
                  await Next.Invoke(context);
                  Log.Debug("LogContext disposato");
              }
          }
      }
  </code></pre>
  
  <p>and here is my Log static setup in global.asax <strong>Application_Start</strong>.</p>
  
  <pre><code>Log.Logger = new LoggerConfiguration()
                  .Enrich.FromLogContext()
                  .ReadFrom.AppSettings()
                  .WriteTo.Async(a =&gt; a.RollingFile(pathFormat: "C:/temp/HcWeb/Log-HCWEB-{Date}.txt", 
                   outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Properties}{Message} 
                                   {NewLine}{Exception}"))
                   .CreateLogger();
  </code></pre>
  
  <p>For some reason that I don't understand, pushed properties are logged only in middleware but these are not presents in Controllers action methods.</p>
  
  <p>This is my rolling file:</p>
  
  <pre><code>2020-06-02 17:52:49.052 +02:00 [Debug] { User: "D'ANDREA VITO" }LogContext impostato
  2020-06-02 17:52:53.846 +02:00 [Debug] { ** NOTHING HERE ** }Hai aperto Stato Pratica
  2020-06-02 17:53:13.660 +02:00 [Debug] { User: "D'ANDREA VITO" }LogContext disposato
  </code></pre>
  
  <p>In similar posts someone forgot the call Enrich.FromLogContext() but this is not my case.
  Should I create Logger in another way, instead of global.asax? </p>