Best Practice for Logging in ASP.NET Core WebAPI
Hello all,
Currently our WebAPIs across the enterprise perform all logging over HTTPS to a central Logging API. Our central Logging API is currently being used for Performance and Error Logging for all our of APIs. The performance logging is triggered anytime an Action in the API is executed and error logging is logged anytime an exception occurs.
To me this approach has some serious design flaws that I would like your opinion on, my main concerns are:
- Every time a client makes a request to our APIs they now are making additional HTTP requests just to perform performance logging and error logging. This seems to me like it would increase the overall response time on the client side.
- If the Logging API is down or unreachable you now have no ability to perform error or performance logging and how would you know that the call to your Logging API failed. It seems like Logging to a file would be much more reliable than the current approach.
- Not that this should happen but it did unfortunately, the endpoint for performance logging was changed after APIs and Applications started utilizing it, thus breaking their ability to log over HTTPS to this Logging API.
A better approach in my opinion seems to be to log to a file using a framework like NLog or Serilog. It seems that this Logging API approach was used to centralize all of the log entries. However, it seems like this may not be the best approach, what do you guys think?
0 comments:
Post a Comment