Shane Wealti
Shane Wealti

Reputation: 2352

How can I log asp.net page generation time

I'm getting complaints from users that an ASP.NET web application I'm responsible for supporting is intermittently slow. How can log page generation time data so that I can quantify if this is the case, and if so which pages are slow, and what time of day. I don't want this information displayed to the user, I just want to log it somewhere for every page request and then I'll take a look at the logs on a daily or weekly basis and import them into a database or excel for manipulation.

I looked at some SO questions that discuss turning on tracing but I haven't been able to determine where that trace data gets logged.

Extra points for being something that doesn't require a code change as this is a production system and I would like to be able to use whatever performance counters and existing log functionality that is provided out of the box instead of rolling my own if possible.

Upvotes: 2

Views: 418

Answers (2)

b0rg
b0rg

Reputation: 1897

IIS Logs, Easiest thing to start with, also requiring least changes. Make sure that "Time Taken" is ticked in the IIS Manager. Default location of the logs will be somewhere here %SystemDrive%\inetpub\logs\LogFiles, (you'll need to identify your web server instance). The time taken field in milliseconds will be appended to request log line. You can import it to excel, or use tools like IIS Log analyzer.

Trace.axd in web.config, make sure the trace is enabled.

<system.web>
<trace enabled="true" localOnly="false" requestLimit="50" />
</system.web>

navigate to application, do something there. then go to http://yourhost/yourApp/Trace.axd, it will display timings from the start for each page events. Some information can be gathered from there. But it's not much.

Upvotes: 2

Royi Namir
Royi Namir

Reputation: 148744

you can use the httpModule with the events : you should make a dll and via webconfig -register it with the httpmodule Section. now you should put a stop watch in the ProcessRequest and PostREquestHandlerExecute. and then youll have the overall time. also you can use trace but its internal to the page itself.... and bypass some of initialize events...

ProcessRequest
..
..
..
page things...
..
..
..
PostREquestHandlerExecute

Upvotes: 0

Related Questions