AspAlliance.com LogoASPAlliance: Articles, reviews, and samples for .NET Developers
URL:
http://aspalliance.com/articleViewer.aspx?aId=991&pId=-1
Detecting ASP Website Errors Using Microsoft Log Parser
page
by Brett Burridge
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 22782/ 32

Introduction

I am always interested in the number and type of ASP errors happening on my websites.  These cause 500 HTTP status codes to be returned to the client web browser.  Depending on how a website is configured, a website may display an error message (in the case of coding errors), a blank screen (if scripts timeout) or something else altogether.  Such errors can be confusing for website users and could significantly reduce the number of transactions completed by users (i.e. leading to loss of sales in the case of ecommerce sites).

Fortunately, IIS usefully logs ASP errors to the IIS web server log file.  They are appended to the querystring field and appear like this:

|-|ASP_0113|Script_timed_out

Searching a log file for "|ASP_" is a good way of finding them.  However, if your log files are very large or you have a lot of them then it is much easier to use a tool to find them.  Although there are a multitude of applications and services available for analyzing web statistics and web server logs, I am a great fan of Microsoft's Log Parser utility.  It allows any type of log file to be queried using standard SQL and the reports to be generated in a number of formats.  It may be downloaded from the Microsoft website or from http://www.logparser.com/.

Configuring Microsoft Log Parser to look for 500 server errors

This Log Parser query assumes that the logs are in c:\logs\web and that IIS has been configured to log in Microsoft's W3C extended log format.  With modified syntax this query could be used to analyze log files in other formats.

The query can be run from a DOS prompt within the Log Parser installation folder.  To save excessive typing or pasting into command prompt windows the whole query can be saved as a .bat file.

logparser "SELECT [cs-uri-stem], [cs-uri-query], Count(*) AS [Hits]
FROM c:\logs\web\ex*.log
WHERE sc-status = 500
GROUP BY [cs-uri-stem], [cs-uri-query]
order by [hits], [cs-uri-stem] DESC" -rtp:-1 -i:iisw3c

Once the query has been put into a batch file (Find500Errors.bat), it can be run using the following when typed at the command prompt (which will produce an output file called 500Errors.txt).

Find500Errors.bat > 500Errors.txt

The query output

The 500 server errors Log Parser query shown above creates a report like the following:

/w/Products.ASPNETDocumentationTool.asp|-|ASP_0113|Script_timed_out 18

/w/Products.ASPDocumentationTool.asp |-|ASP_0113|Script_timed_out 18

/w/Products.IndexServerCompanion.SampleSearch.asp|33|800a01f4|Variable_is_undefined:_'LogEvent' 11

/w/News.asp|-|ASP_0113|Script_timed_out 5

/w/Affiliates.asp|-|ASP_0113|Script_timed_out 5

/w/Products.IndexServerCompanion.SampleSearch.aspquery=the&I1.x=0&I1.y=0|126|80041605|
The_query_contained_only_ignored_words._ 4

/w/Products.IndexServerCompanion.Download.aspAction=Step2|48|800a0bcd|
Either_BOF_or_EOF_is_True__or_the_current_record_has_been_deleted.
_Requested_operation_requires_a_current_record. 4

/w/Products.ASPDocumentationTool.Screenshots.asp |-|ASP_0113|Script_timed_out 4

/w/Downloads.asp |108|8007000e|[Microsoft][ODBC_Microsoft_Access_Driver]_Not_enough_space_on_temporary_disk. 2

/w/Downloads.asp |108|80004005|Unspecified_error 2

For each of the errors it reports the page on which the error was encountered, the details of the error and the number of times each page reported the particular error.  Due to the query's order by clause, the most common errors are listed first.  The group by clause is used to group identical errors from each page.

As may be seen from this sample output, a comprehensive overview of the website's problems may be gained.  In this particular example the number of timeout errors would indicate that the website has significant performance issues.  Other errors in this sample include an ASP coding error ("Variable_is_undefined") and an Indexing Services error ("The_query_contained_only_ignored_words").  Fixing these errors could lead to significant enhancement of the user's experience of the website.


Product Spotlight
Product Spotlight 

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-29 4:01:32 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search