Tuesday, May 22, 2012

SharePoint 2010 find error messages with a Correlation ID token

Introduction

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.

Correlation ID, what's that?

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!

You might get an error message like this in SharePoint 2010 (don't worry, if you haven't seen one like this one yet – just hang in there, sooner or later you will..Winking smile)

image

Run in SharePoint 2010 Management Shell


Replace 

1464bf90-83a2-4260-921e-1c44c227425c with your Correlation ID

get-splogevent | ?{$_.Correlation -eq "f08306fc-568a-476b-b732-384243204b21"}

image


get-splogevent | ?{$_.Correlation -eq "1464bf90-83a2-4260-921e-1c44c227425c"} | select Area, Category, Level, EventID, Message | Format-List > C:\Awesome.log


get-splogevent | ?{$_.Correlation -eq "f08306fc-568a-476b-b732-384243204b21"} | select Area, Category, Level, EventID, Message | Format-List


image


For details follow this link 



--
Shahzad Afzal
http://www.pakistanprobe.com/



No comments:

Popular Posts