cjbhaines / Log4Net.Async

Asynchronous Log4Net appenders and forwarder
http://www.nuget.org/packages/Log4Net.Async/
MIT License
121 stars 37 forks source link

Referenced HttpContext is not guaranteed to be valid. #43

Open Vycka opened 4 years ago

Vycka commented 4 years ago

https://github.com/cjbhaines/Log4Net.Async/blob/122bface9668ea325203426f31ba037ce29d8698/src/Log4Net.Async/AsyncForwardingAppenderBase.cs#L30 https://github.com/cjbhaines/Log4Net.Async/blob/122bface9668ea325203426f31ba037ce29d8698/src/Log4Net.Async/ParallelForwardingAppender.cs#L200 There are no guarantees that HttpContext is still gonna be valid when client closes connection. And at least using it with heavy-loaded Kestrel it seems to be always the case and results logging not working at all. There are also no guarantees that logging is gonna be used in environment where HttpContext even exists. And HttpContext here seems to be only used for throwing exceptions and the need of it probably can just be removed.