Part of SharePoint 2010, a new tool was added to made life easier: the developer dashboard. By default disabled, you can enable it multiple ways:

Using STSADM:

stsadm –o setproperty –pn developer-dashboard –pv ondemand

Using PowerShell:

$level=”OnDemand”

[void][System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)

[void][System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Administration”)

$contentSvc=[Microsoft.SharePoint.Administration.SPWebService]::ContentService

$contentSvc.DeveloperDashboardSettings.DisplayLevel=([Enum]::Parse([Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel],$level))

$contentSvc.DeveloperDashboardSettings.Update()

Write-host(“Level:” + $contentSvc.DeveloperDashboardSettings.DisplayLevel)

Values available to be set for the developer dashboard:

  • On
  • Off
  • OnDemand

Using code:

SPWebService srv = SPWebService.ContentService;

srv.DeveloperDashboardSettings.DisplayLevel = SPDeveloperDashboardLevel.OnDemand;

srv.DeveloperDashboardSettings..Update();

NOTE: using SPFarm is not supported in the final release of SharePoint.

Happy debugging!

Advertisements