0

Our software suddenly started logging the complete HTTP Headers, filling up the log files

[08:32:53.5245][Debug]ReadAsync[642] 47 45 54 20 2F
GET / HTTP/1.1
Host: localhost:4432
Connection: keep-alive

[08:32:53.5245][Debug]WriteAsync[201] 48 54 54 50 

No changes were made to the nlog.config or the appsettings.json

The only change was a newer .net core runtime 2.1.16 in our installer

Appsettings:

"Logging": {
  "IncludeScopes": false,
  "LogLevel": {
    "Default": "Trace",
    "System": "Warning",
    "Microsoft": "Warning"
  }
},

partial nlog.config

 <!--Skip Microsoft logs and so log only own logs-->
 <logger name="Microsoft.*" minlevel="Trace" writeTo="blackhole" final="true" />

This problem does not occur on the development system

Julian
  • 33,915
  • 22
  • 119
  • 174
Erik Oppedijk
  • 3,496
  • 4
  • 31
  • 42

1 Answers1

1

Apparently the way to solve this was to first add the ${logger} to the nlog.config layout output to trace the root.

This showed that the KestrelConnectionLogger was the source

With this, the following line could be added to the nlog.config

<logger name="KestrelConnectionLogger" minlevel="Trace" writeTo="blackhole" final="true" />
Julian
  • 33,915
  • 22
  • 119
  • 174
Erik Oppedijk
  • 3,496
  • 4
  • 31
  • 42
  • 1
    FYI, the `writeTo="blackhole"` ins't needed more these days. Just remove the `writeTo` attribute at all, then the messages are implicitly send to a blackhole – Julian Apr 08 '20 at 07:18