Home
Manage Your Code
Snippet: Logging to SharePoint using SharePoint Diagnostics (C#)
Title: Logging to SharePoint using SharePoint Diagnostics Language: C#
Description: This one line of code will log to the sharepoint logs. Views: 342
Author: Kumanan Murugesan Date Added: 7/10/2012
Copy Code  
1SPDiagnosticsService.Local.WriteTrace(0,new SPDiagnosticsCategory("YourProductName",TraceSeverity.Medium, EventSeverity.Warning),TraceSeverity.Medium,  "Testing logging","klklklkl");
Usage
The above code will log to the sharepoint logs. It will be located in the following directory.
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS

To view the logs, use ulsviewer. you can download it from 
http://archive.msdn.microsoft.com/ULSViewer/Release/ProjectReleases.aspx?ReleaseId=3308