Like authentication, caching, and exception management, logging is a crosscutting concern – a function that affects the entire application – that should be centralized. We often log application data that may include the sequence of method calls or events, user actions, or even errors that may occur when the application executes.

There are many logging frameworks you could take advantage of, but in this article we’ll focus on how we can log requests and responses in ASP.Net Web API.Logging requests and responses in Web API is helpful in debugging, tracing, and inspection of the incoming and outgoing service calls.

By logging all requests and responses in one place, detecting problems in any requests and responses becomes easy.
In this post, we will create a custom message handler to monitor and log requests and responses in Web API.

The message handler will be used to intercept calls and log all requests and responses centrally in one place.To read this article in full or to leave a comment, please click here

Leave a Reply