Tracing the Stack in SharePoint

As a SharePoint developer used to working with pure .Net, the first thing that I had to get adjusted to was SharePoint’s error handling and general debugging. Error messages, when they say anything other than a generic “error has occurred” message, are often irrelevant to the actual error that’s occurring.

Worse, the sharepoint logs are OVERLOADED with entries (I’ve seen SharePoint write over 100 log entries in a second) making it very very hard to find the entries that actually contain an error (this is why someone long ago invented the “log viewer”).

Add to that there is no switch in place in Central Administration to enable detailed errors, it instead requires manual modifications of the web.config file. So if you’d like to be able to see the stack trace of the error that is occurring, open the web.config file of your Central Administration site (or a different site if you so choose, located in C:\Inetpub\wwwroot\wss\VirtualDirectories\YourSitePort) and edit the following entries to turn off Custom Errors and enable the Call Stack:

<system.web>
    <customErrors mode="on" />
</system.web>

Should say…

<system.web>
    <customErrors mode="off" />
</system.web>

And

<SharePoint>
    <SafeMode MaxControls="50" CallStack="false" />
</SharePoint>
Should say…
<SharePoint>
    <SafeMode MaxControls="50" CallStack="true" />
</SharePoint>

If you are debugging a production system, you can instead set the “customErrors” mode to “remoteOnly”, this will allow the stack trace to be shown on the server’s browser, but not on any remote computers.

I guess we can chalk this lack of easy to use error handling on to the list of SharePoint “oversights” on Microsoft’s part (along with the lack of a x64 SDK, the SPTimer bug that often can’t queue more than 15 items correctly, and the fact that their paid SharePoint support line is usually unable to actually, you know, support anyone. At least we got our money back!)

Advertisements

0 Responses to “Tracing the Stack in SharePoint”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: