Exemple #1
0
 public static void LogException(Exception ex)
 {
     if (ex != null)
     {
         lock (_exceptionLock)
         {
             string path = Settings.SettingsPath;
             using (System.IO.StreamWriter writer = new System.IO.StreamWriter(path + @"exception.log", true))
             {
                 writer.WriteLine(DateTime.Now.ToString(@"yyyy/MM/dd HH\:mm\:ss.fff") + ": Unhandled Exception: " + ex.Message + Environment.NewLine);
                 writer.WriteLine(ex.ToString());
                 writer.WriteLine("--------" + Environment.NewLine + Environment.NewLine);
                 MainLog.WriteError(ex.Message);
             }
         }
     }
 }