With ELMAH feature in web api 2.0 and Centralized logging and error handling , runtime calls logging module and decide if it can be handled then calls the handler else just logs it.. how can this feature be added in web api core. as we don't have inbuilt centralized unhandled logging feature..
One way I got is to use ExceptionHandler middleware and when it gets called, get the exception and log it or send email.. but what if handler doesn't get called .. how to log those unhandled exceptions ?
Middleware could be a way to go yes. I've written a guide here: Error Logging Middleware in ASP.NET Core.
I would probably look at Microsoft.Extensions.Logging in combination with a logging framework like Serilog, NLog or log4net.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With