Create an eventlog entry
For exception handling it is good practice to write errors to the eventlog.
EventLog.WriteEntry(“SharePoint.Error”, errorText, EventLogEntryType.Error);
Since SP1 for Windows Server 2003 “the normal user” is not allowed to write to the eventlog. James Kovacs wrote a great article about the problem.
(Remember to create your eventlog source, if you have your own!)
1: if(!EventLog.SourceExists(“SharePoint.Error”, ".")) {
<span class=lnum> 2: </span> EventLog.CreateEventSource(<span class=str>"SharePoint.Error"</span>, <span class=str>"Application"</span>, <span class=str>"."</span>);
3: }