/[AnywhereTS-MSSQL]/trunk/TSAdminTool/Program.cs
ViewVC logotype

Diff of /trunk/TSAdminTool/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/TSAdminTool/Program.cs	2012/07/12 20:06:53	69
+++ trunk/TSAdminTool/Program.cs	2012/07/12 20:47:35	70
@@ -41,32 +41,28 @@
             if (e.GetType() == typeof(SqlException))
             {
                 SqlException sql_ex = (e as SqlException);
-                List<object> strs = new List<object>();
+                List<string> strs = new List<string>();
                 using (log4net.NDC.Push(string.Format("{0}: ID={1} MESSAGE={2}{3}Diagnostics:{3}{4}", sql_ex.GetType().Name, sql_ex.Number.ToString(), sql_ex.Message, System.Environment.NewLine, sql_ex.ToString())))
                 {
-                    Stack stack = log4net.NDC.CloneStack();
-                    strs = new List<object>(stack.ToArray());
-                    strs.Reverse();
+                    strs = Logging.GetMessagesFromThreadContextStack("NDC");
                     Logging.ATSAdminLog.Error("Encountered unhandled Exception");
                 }
                 StringBuilder builder = new StringBuilder();
-                foreach (object str in strs) { builder.AppendLine(str.ToString()); }
+                foreach (string str in strs) { builder.AppendLine(str); }
                 result = ShowAbortRetryIgnoreDialog("Encountered unhandled Exception", builder.ToString());
                 if (result == DialogResult.Abort)
                     Application.Exit();
             }
             else
             {
-                List<object> strs = new List<object>();
+                List<string> strs = new List<string>();
                 using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", e.GetType().Name, e.Message, System.Environment.NewLine, e.ToString())))
                 {
-                    Stack stack = log4net.NDC.CloneStack();
-                    strs = new List<object>(stack.ToArray());
-                    strs.Reverse();
+                    strs = Logging.GetMessagesFromThreadContextStack("NDC");
                     Logging.ATSAdminLog.Error("Encountered unhandled Exception");
                 }
                 StringBuilder builder = new StringBuilder();
-                foreach (object str in strs) { builder.AppendLine(str.ToString()); }
+                foreach (string str in strs) { builder.AppendLine(str); }
                 result = ShowAbortRetryIgnoreDialog("Encountered unhandled Exception", builder.ToString());
                 if (result == DialogResult.Abort)
                     Application.Exit();

 

  ViewVC Help
Powered by ViewVC 1.1.22