Showing posts with label log SharePoint 2010. Show all posts
Showing posts with label log SharePoint 2010. Show all posts

Sunday, December 26, 2010

Logging in Sharepoint 2010

Logging in SharePoint 2010 is a pretty straight forward affair. The code block below will write to 14\LOGS 

using Microsoft.SharePoint.Administration;

                SPDiagnosticsService.Local.WriteTrace(0,
                    new SPDiagnosticsCategory("CustomComponent", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);

If you want to create your own custom logging component, the following two blogs will assist you.

http://blog.mastykarz.nl/logging-uls-sharepoint-2010/
http://www.sharepointproconnections.com/article/sharepoint-development/SharePoint-Logging-What-s-New-in-SharePoint-2010.aspx