Logging SharePoint Errors

 

As usual, when I find something useful, I like to stash it away here for safe-keeping.

Found this old, old post by Clayton James on logging errors to a SharePoint ULS file. In this post he provides the following snippet:

catch(Exception myException)
{

Microsoft.Office.Server.Diagnostics.PortalLog.LogString(“Exception

Occurred: {0} || {1}”, myException.Message, myException.StackTrace);

}

Technorati Tags: SharePoint,SharePoint 2007,SharePoint Development,Development,C#