ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/AnywhereTS-MSSQL/trunk/TSControlPanel/Program.cs
(Generate patch)

Comparing trunk/TSControlPanel/Program.cs (file contents):
Revision 72 by william, Thu Jul 12 20:47:35 2012 UTC vs.
Revision 73 by william, Thu Jul 12 22:00:37 2012 UTC

# Line 40 | Line 40 | namespace AnywhereTS
40              Exception e = (Exception)args.ExceptionObject;
41              if (e == null)
42              {
43 <                Logging.TSControlPanelLog.Error("Encountered unhandled Exception, but the exception was null");
43 >                Logging.ATSAdminLog.Error("Encountered unhandled Exception, but the exception was null");
44                  return;
45              }
46              if (e.GetType() == typeof(SqlException))
# Line 49 | Line 49 | namespace AnywhereTS
49                  List<string> strs = new List<string>();
50                  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())))
51                  {
52 <                    strs = Logging.GetMessagesFromThreadContextStack("NDC");
53 <                    Logging.ATSAdminLog.Error("Encountered unhandled Exception");
52 >                    Exception inner = sql_ex.InnerException;
53 >                    if (inner != null)
54 >                    {
55 >
56 >                        if (inner.GetType() == typeof(SqlException))
57 >                        {
58 >                            SqlException sql_inner = inner as SqlException;
59 >                            using (log4net.NDC.Push(string.Format("{0}: ID={1} MESSAGE={2}{3}Diagnostics:{3}{4}", sql_inner.GetType().Name, sql_inner.Number.ToString(), sql_inner.Message, System.Environment.NewLine, sql_inner.ToString())))
60 >                            {
61 >                                strs = Logging.GetMessagesFromThreadContextStack("NDC");
62 >                                Logging.ATSAdminLog.Error("Encountered unhandled Exception");
63 >                            }
64 >                        }
65 >                        else
66 >                        {
67 >                            using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", inner.GetType().Name, inner.Message, System.Environment.NewLine, inner.ToString())))
68 >                            {
69 >                                strs = Logging.GetMessagesFromThreadContextStack("NDC");
70 >                                Logging.ATSAdminLog.Error("Encountered unhandled Exception");
71 >                            }
72 >                        }
73 >                    }
74 >                    else
75 >                    {
76 >                        strs = Logging.GetMessagesFromThreadContextStack("NDC");
77 >                        Logging.ATSAdminLog.Error("Encountered unhandled Exception");
78 >                    }
79                  }
80                  StringBuilder builder = new StringBuilder();
81                  foreach (string str in strs) { builder.AppendLine(str); }
# Line 63 | Line 88 | namespace AnywhereTS
88                  List<string> strs = new List<string>();
89                  using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", e.GetType().Name, e.Message, System.Environment.NewLine, e.ToString())))
90                  {
91 <                    strs = Logging.GetMessagesFromThreadContextStack("NDC");
92 <                    Logging.ATSAdminLog.Error("Encountered unhandled Exception");
91 >                    Exception inner = e.InnerException;
92 >                    if (inner != null)
93 >                    {
94 >                        using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", inner.GetType().Name, inner.Message, System.Environment.NewLine, inner.ToString())))
95 >                        {
96 >                            strs = Logging.GetMessagesFromThreadContextStack("NDC");
97 >                            Logging.ATSAdminLog.Error("Encountered unhandled Exception");
98 >                        }
99 >                    }
100 >                    else
101 >                    {
102 >                        strs = Logging.GetMessagesFromThreadContextStack("NDC");
103 >                        Logging.ATSAdminLog.Error("Encountered unhandled Exception");
104 >                    }
105                  }
106                  StringBuilder builder = new StringBuilder();
107                  foreach (string str in strs) { builder.AppendLine(str); }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines