Skip to main content

Mark Wagner - Cogitation Blog

Go Search
Blog
SPDev
SharePoint
Governance
  

Welcome
Mark Wagner works for Microsoft as a Consultant working in the West Region.
My old blog
Mark Wagner - Cogitation Blog > Posts > Logging to the SharePoint Log Files
Logging to the SharePoint Log Files

Thanks to Brad Younge for sharing this a while back.  Below is an example on how to write to the SharePoint log files (located in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS folder).

catch(Exception e)
{
   Microsoft.Office.Server.Diagnostics.PortalLog.LogString("Exception: {0} - {1}", e.Message, e.StackTrace);
}

You’ll likely want to prefix your log entries with a date and time stamp.

Comments

There are no comments yet for this post.
Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's Date *

Please enter today's date. This will help prevent blog spam. Thank you.
Attachments