In SharePoint 2010, you’ve got some new capabilities for error reporting and logs. One of the most noted features for me as a developer is that whenever you bump into an error message – you’ll be presented with a correlation ID token.
In this article I will try to explain how you can fetch that token from SharePoint, and also provide a small snippet of code to be able to build your own “Log Searcher Web Part” for your administrators.
In SharePoint 2010, you get a Correlation ID (which is a GUID) attached to your logs/error messages when something happens. This ID can then be used to lookup that specific error from the logs.
This Correlation ID is used per request-session in SharePoint 2010,
and if you are in the process of requesting some information from
SharePoint and bump into some problems along the way – your Correlation
ID will be the best starting point for searching for what went wrong
along that request!
So if you’ve gotten such an error message and want to find out more information about the actual error and don’t have the time to go around poking in the logs and searching – there’s a few methods you can do this rather easily, as described below.
One of the quick-n-awesome ways to do this is to simply hook up a
PowerShell console (SharePoint 2010 Management Shell) and then just
write the following command (replace the <GUID> with the
You might want to be more precise and get more specific details out of your query, then you can try something like this:
Finally if you would want these messages to be put into a text or log file instead, you could just add the classic “> C:\Awesome.log” after the command like this:
On MSDN they have an overvoew of using SP-GetLogEvent which I would recommend!