Ejemplo n.º 1
0
        public static void LogError(Exception ex)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                Exception     e  = ex;

                sb.AppendLine("----" + DateTime.Now + " ----");
                while (e != null)
                {
                    sb.AppendLine(getErrorText(e));
                    e = e.InnerException;
                }

                sb.AppendLine(new string('-', 25));

                if (Server.s != null)
                {
                    Server.s.ErrorCase(sb.ToString());
                }

                lock (_lockObject)
                {
                    _errorCache.Enqueue(sb.ToString());
                    Monitor.Pulse(_lockObject);
                }



                if (NeedRestart)
                {
                    Server.listen.Close();
                    Server.Setup();
                    //http://alltheragefaces.com/img/faces/large/misc-jackie-chan-l.png

                    NeedRestart = false;
                }
            } catch (Exception e) {
                try
                {
                    File.AppendAllText("ErrorLogError.log", getErrorText(e));
                }
                catch (Exception _ex)
                {
                    MessageBox.Show("ErrorLogError Error:\n Could not log the error logs error. This is a big error. \n" + _ex.Message);
                }
            }
        }