ASP.NET Application Logging


Sponsored Links

73058_New Scooba® 230 Floor Washing Robot + Free Shipping!

 

ASP.NET Application Logging

Here we look at of the ways it's possible to perform application logging in ASP.NET. This can be useful if some strange behaviour is occuring on the server such as a slowdown, and you need more information to discover what is wrong, or just monitor the health of an ASP.NET application.

Tracing

Tracing can be switched on in the web.config to trace page requests and store them, you can access them by the using the filename trace.axd. Using the configuration below will enable tracing to be recorded for the last 100 requests, where you can inspect timings of the various events been fired, inspect form variables, cookies, custom trace messages. In it's basic form it will highlight if any events are particularly slow.


<trace
    enabled="true"
    pageOutput="false"
    requestLimit="100"
    traceMode="SortByTime"
    localOnly="false"
    mostRecent="true"
    />


These settings, firstly switch tracing on with the enable switch, disable page output so that only trace.axd contains the tracing information and it's not appended to the bottom of every page (which is a security risk). We set the limit to the most recent 100 tracing requests sorted by time. LocalOnly set to false means every request will generate a trace, not just those run from the server.

Generally advise seems to be not to leave tracing running all the time, just when you need it.