How to Log errors to SharePoint Log file
In SharePoint log files are available under \Common Files\Microsoft Shared\web server extensions\12\LOG.
Exceptions can be logged to the default SharePoint log file using the following line of code.
Microsoft.Office.Server.Diagnostics.PortalLog.LogString(”Exception Occurred: {0} || {1}”, Ex.Message, Ex.StackTrace);
Note: Make sure that you add the reference to Microsfot.Office.Server dll
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments
No comments yet.
Leave a comment