Per request tracing in ASP.NET Web API

added by Paul Wheeler
3/10/2014 5:46:09 PM

5 Kicks, 74 Views

Web API allows you to plug in extensive logging mechanism through the ITraceWriter service. This will log all important events in the pipeline – such as selection of the controller, action, parameter binding and so on – all of which are extremely important in debugging all kinds of issues. However, any existing instance of an ITraceWriter would log all of the information aside – into a log file, trace, database. But what if you wanted all the trace information produced while the given request was being processed, to be returned together with the server response? Let’s have a look.