Debugging is difficult when developing custom functionality for Windows SharePoint Services 3.0 (WSS) or Microsoft Office SharePoint Server (MOSS). The main culprit is that SharePoint normally surfaces very little diagnostic information on the web browser when an error occurs. This blog entry describes how to locate additional system-generated diagnostic information that can often provide that extra bit of detail that one needs in order to identify root causes. This can then lead to solving the problem.
I have used this technique with great success to solve otherwise mysterious errors.
SharePoint saves a great deal of information to a diagnostic log in a log file in the 12 hive.
The "12 hive" is usually located at "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12". (I’m not sure if it’s possible for the 12 hive to live anywhere else, in fact).
The idea is to locate the current log file, force the error and then quickly open the log file. These log files are characterized by:
- Copious amounts of information. SharePoint generates a very large amount of diagnostic information and writes it to that log file very quickly. You need to be quick with the fingers to capture it.
- Multiplicity. SharePoint does not write to a single log file but rather generates multiple log files in sequence.
- Copy and paste nicely into MS Excel.
My favorite method:
- Open up a windows explorer pointing to the 12 hive\logs.
- Sort the view to show by modified date (most recent first).
- Highlight the most current log file.
- In a web browser window, force the error to occur.
- Quickly open the current log file and copy its contents to MS Excel.
- Jump to the end and analyze the relevant entries.
By default, the diagnostic log is located in the 12 hive\LOGS directory.
MS Best practices (as per Mike T. of Microsoft) state that the log files should be saved to a separate hard drive. One does this via central admin. Your system administrator may have done this, in which case you’d obviously need to find the log file there instead of the default 12 hive location).
This entry addresses issues such as:
- SharePoint workflow failed to start due to an internal error.
- (more to be added over time)
- This entry has been helpful diagnosing workflow errors (e.g. "The workflow failed to start due to an internal error").