Hooking up Request Logging
If you plan on logging every request in your application you can do so by implementing this class in the Application_EndRequest event handler in global.asax.
To also log request durations you can optionally capture the start time in Application_BeginRequest and a Context variable to keep track of this time and pass it as a final parameter to Log() method. A typical implementation that logs with duration looks like this:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
//*** Request Logging
if (App.Configuration.LogWebRequests)
Context.Items.Add("WebLog_StartTime",DateTime.Now);
}
protected void Application_EndRequest(Object sender, EventArgs e)
{
// *** Request Logging
if (App.Configuration.LogWebRequests)
{
try
{
Westwind.Tools.WebRequestLog.Log(App.Configuration.ConnectionString,
false,
(DateTime) Context.Items["WebLog_StartTime"]);
}
catch {;}
}
}
In the application the Request Log can be viewed and managed from the Administration Page.
© West Wind Technologies, 1996-2018 • Updated: 01/06/04
Comment or report problem with topic