private void WriteToEventLog(FbException e, string action) { EventLog log = new EventLog(); log.Source = eventSource; log.Log = eventLog; StringBuilder sb = new StringBuilder(50); sb.AppendFormat("An exception occurred. Please check the Event Log.{0}", Environment.NewLine); sb.AppendLine(); sb.AppendFormat("Action: {0}{1}", action, Environment.NewLine); sb.AppendLine(); sb.AppendFormat("Exception: {0}{1}", e.ToString(), Environment.NewLine); log.WriteEntry(sb.ToString()); }