There are some scenarios were application.Server.GetLastError() returns null even though Response.StatusCode is 500. In such cases extra check to get the latest error from Context.AllErrors will help Serilog to log appropriate exception in configured sink.
There are some scenarios were application.Server.GetLastError() returns null even though Response.StatusCode is 500. In such cases extra check to get the latest error from Context.AllErrors will help Serilog to log appropriate exception in configured sink.