Three are 2 sections where you can log the SharePoint Errors.
1. ULS Logs
2. Event Logs
Detailed steps are given below:
1. Configure ULS Logging
CA -> Monitoring section -> Reporting Section -> Configure diagnostic logging.
The default location is C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS. If you want, you can change the Log path on all servers in the farm.
Use SPDiagnosticsService.Local.WriteTrace to write the entries into ULS logs
2. Event Logging
Use EventLog.WriteEntry to entries to event log. It is derived from System.Diagnostics class
Example:
EventSource = “CustomEvent”
if (!EventLog.SourceExists(EventSource ))
EventLog.CreateEventSource(EventSource ,”Application”);
EventLog.WriteEntry(EventSource,Errormessage,EventLogEntryType.Error);
No comments:
Post a Comment