damianh / LimitsMiddleware

OWIN middleware to apply limits to an OWIN pipeline.
MIT License
0 stars 0 forks source link

Logs added even if no logger set #29

Closed mskvorcovs closed 6 years ago

mskvorcovs commented 6 years ago

I'm setting appBuilder.MaxRequestContentLength(1024*Utils.MaxRequestSizeKb, null); //x1024 for kilobytes But still my log is flooded with messages like:

2017-10-18 13:53:23,677 - Max valid content length is 51322880. 2017-10-18 13:53:23,677 - Not a chunked request. Checking content length header. 2017-10-18 13:53:23,677 - Content length header check passed. 2017-10-18 13:53:23,677 - Request body stream configured with length limiting stream of 51322880. 2017-10-18 13:53:23,677 - Request forwarded.

These lines are added for each request.

damianh commented 6 years ago

This project uses LibLog. Logging will be automatically wired up. Those log messages are at debug leve.

Setting the logname to null doesn't disable it.

Instead, in your logging configuration,

  1. set your logging level to higher than debug, or ...
  2. ...sink/filter all logs from "LimitsMiddleware.MaxRequestContentLength" (or your own log name, if you supply it) to a null logger, or...
  3. ... filter out all messages from "LimitsMiddleware.MaxRequestContentLength".

I know this is possible for Serilog