Log to SharePoint log file.

15. June 2010

1. Create a project (It seems .net 4 doesn't work well with SharePoint 2007)
2. Add the reference to Microsoft.Office.Server.dll. (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI)
3. The log code looks like this.

try
{
  throw new Exception("This is a test");
}
catch (Exception ex)
{
  Microsoft.Office.Server.Diagnostics.PortalLog.LogString(ex.Message, null);
}

Done

Sharepoint ,

Comments

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading