Posts Writing in Sharepoint log file

Writing in Sharepoint log file

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);

This post is licensed under CC BY 4.0 by the author.