zaterdag 23 oktober 2010

Preparing your environment for debugging

By default, SharePoint will suppress error messages to the user. When something goes wrong you will most likely see the famous 'Unexpected error'. If you want to see the full message, there are some web.config settings you need to change. In SharePoint 2007 you only had to set these settings in the root web.config, in SharePoint 2010 you need to alter different ones.

Enabling web.config to enable debug information

SharePoint 2007:
- in your web application's root (C:\inetpub\wwwroot\wss\VirtualDirectories\SharePointSiteFolder), open the web.config and change the following settings. The following settings are correct:

   1: <compilation batch=”falsedebug=”true>


   2: <SafeMode MaxControls="200" CallStack="true"/>


   3: <customErrors mode=”Off>


SharePoint 2010:

- also change the web.config in the web application's root directory as described for SharePoint 2007
- the one that you can find into the "LAYOUTS" directory under the SharePoint root (the file at the path: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS)

Finding extra debug/logging information
* Use the event viewer: a lot of the thrown exceptions will also write stack traces there
* Enable SharePoint 2010 logging by opening the Central Administration and going to ‘Monitoring –> Configure diagnostic logging'

Untitled

Select what sources should be logged. A lot of new logging information will now be available under C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS.

Developer dashboard
Very handy to use and new in SharePoint 2010. You can turn it on using stsadm or PowerShell:

stsadm -o setproperty -pn developer-dashboard -pv on
(Get-SPFarm).PerformanceMonitor.DeveloperDashboardLevel = ”On”

What will happen is that at the bottom of each loaded page, extra information information about the loaded components on that page are shown. You can see what has been loaded, how long it took, which SQL queries were launched, wich web services were consumed, ... .

Untitled


More information on how to use it you can find here.

Geen opmerkingen:

Een reactie posten