public static class Log { public static void LogError(Exception ex) { EventLog.WriteEntry("Application", ex.Message + " Trace" + ex.StackTrace, EventLogEntryType.Error, 121, short.MaxValue); } }2 - Then Call this Static Method inside Catch Block.
try { } catch (Exception ex) { Log.LogError(ex); }