Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tracing in MVC web API Application

I'm looking for a good framework for tracing activities in asp.net MVC. I've implemented registration to action filters with in ActionFilterAttribute. But I want to have see all activities like WCF tracing offers. Since the operation is posting to service , I want it to be traced to file like tracing in WCF.

10x, Rony

like image 999
ron Avatar asked May 20 '13 12:05

ron


People also ask

What is tracing in Web API?

Tracing is used to follow the path of the execution page. It displays the diagnostic information of the the execution page at run time. It is used to debug the application. It can be integrated with the system level tracing that provides multiple levels of tracing.

Can tracing be enabled in Web API?

Tracing in Web API uses a facade pattern: When tracing is enabled, Web API wraps various parts of the request pipeline with classes that perform trace calls.

What is trace in MVC?

Trace can be a useful tool for logging and debugging, and sometimes it would be handy to be able to call one of the tracing methods from a Razor view. For example, when an MVC application runs in production, by default MVC catches most application exceptions for you and routes them to Views/Shared/Error. cshtml.

How do I enable tracing in web config?

To enable tracing for an applicationAdd a trace element as a child of the system. web element. In the trace element, set the enabled attribute to true. If you want trace information to appear at the end of the page that it is associated with, set the trace element's pageOutput attribute to true.


2 Answers

For now I found a nice thing.

<system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <add name="textLogListener" type="System.Diagnostics.TextWriterTraceListener"
             initializeData="app.log"  />
        <remove name="Default" />
      </listeners>
    </trace>
  </system.diagnostics>
like image 182
ron Avatar answered Nov 03 '22 16:11

ron


Check out Glimpse. Glimpse is an easy way to view tracing activities.

like image 21
James Lawruk Avatar answered Nov 03 '22 15:11

James Lawruk