.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Correlation ID and trace logs

Posted By:Manning       Posted Date: February 26, 2011    Points: 100    Category: SharePoint    URL: http://www.dotnetspark.com  

Correlation ID and trace logs in SharePoint. The author discusses two features that enable you to troubleshoot applications during development or in production

This article is taken from the book SharePoint 2010 Web Parts in Action. The author discusses two features that enable you to troubleshoot applications during development or in production.

40% off any version of SharePoint 2010 Web Parts in Action with the checkout code dnspark40. Offer is only valid through www.manning.com.

SharePoint 2010 contains numerous features that let you troubleshoot applications whether you're developing or running the application in production. All requests to SharePoint are given a unique ID that can be used to trace a specific error message to a request. This ID is called the Correlation ID. Depending on how you have configured SharePoint errors, warnings and information messages are logged to the SharePoint specific trace logs, databases, or the Windows Event Log. All of these log entries contain the Correlation ID, which allows you to combine logs from different sources to get a bigger picture of a specific error or warning.

The Correlation ID is new in SharePoint 2010 and this unique value is shown on the default error page in SharePoint. The default error page never shows the exact error to the end users, but they can send the Correlation ID to the support team for further investigation. Any custom logging to the log files will also contain this specific ID.

The trace logs, also called ULS logs, are one primary source when searching for exceptions and problems with your SharePoint installation. These log files can be monitored by external monitoring systems and searched using simple text editing tools or PowerShell.

Introducing the Correlation ID

Errors can be shown in various ways in SharePoint. Unhandled errors and exceptions will eventually be displayed using the SharePoint error page unless you have turned it off. This custom error page that reads, "An unexpected error has occurred". Although this error message doesn't help you much, SharePoint 2010 always displays a unique error ID called Correlation ID, as seen in figure 1. One reason not to show the actual error message is that doing so can reveal too much about the application and render it vulnerable to hackers.

Figure 1 The default error page in SharePoint 2010 does not show any information about the actual error but instead shows a Correlation ID that can be used when searching for the problem in the logs.

The Correlation ID is guaranteed to be unique for that particular error at that given time. This ID won't give any clues or help to an end user but for an administrator can use this Correlation ID to search the log files for the actual error message and source. A Correlation ID is not given only to errors; every request and action is given a unique Correlation ID. This ID is also consistent over the whole farm and across service applications.

Customizing the error page

If you want to, you can customize the error page to provide the end users with more information or instruct them to send the error message to the support team. The error page is located in {SharePoint Root}/TEMPLATE/LAYOUTS/ and is called error.aspx.

If an unhandled error occurs on a Web Part Page or Wiki Page a link to the Web Parts Maintenance Page is provided. This link can be used to inspect what Web Parts are on the page and remove those Web Parts that are failing.
SharePoint trace logs

Almost everything in SharePoint can be logged. SharePoint logs information to the Unified Logging Service, which stores the information in the file system under {SharePoint Root}\LOGS. These logs are called the ULS logs or the trace logs. All events can be logged to the trace logs and some information is also logged to the standard Windows Event Logs. What and how much to log in the trace and event logs is configured in Central Administration > Monitoring > Configure Diagnostics Logging, as seen in figure 2.

Figure 2 The logging levels for the trace log and event log are configured in Central Administration.

Trace logs always contain the Correlation ID and this ID is preserved over multiple servers, for example, when Service Applications are invoked on other servers. This behavior makes it easy to find errors. The log files are plain text files and can be opened with any text editing tool, but searching to get an overview of the events using those tools is difficult. There are several downloadable tools available that will help you search and monitor log files. I recommend that you use the ULS Viewer by Microsoft, which can be downloaded at http://code.msdn.microsoft.com/ULSViewer.


SharePoint is built upon Microsoft.NET and ASP.NET and you can use the same techniques for handling errors and troubleshooting them. SharePoint contains a set of out-of-the-box tools like the logging features that will help you a lot when fighting fierce Web Parts.

SharePoint 2010 Web Parts in Action

Wictor Wilén
MEAP Release: March 2010
Softbound print: December 2010 (est.) | 375 pages
ISBN: 9781935182771

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend