44 |
|
List<string> strs = new List<string>(); |
45 |
|
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()))) |
46 |
|
{ |
47 |
< |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
48 |
< |
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
47 |
> |
Exception inner = sql_ex.InnerException; |
48 |
> |
if (inner != null) |
49 |
> |
{ |
50 |
> |
|
51 |
> |
if (inner.GetType() == typeof(SqlException)) |
52 |
> |
{ |
53 |
> |
SqlException sql_inner = inner as SqlException; |
54 |
> |
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()))) |
55 |
> |
{ |
56 |
> |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
57 |
> |
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
58 |
> |
} |
59 |
> |
} |
60 |
> |
else |
61 |
> |
{ |
62 |
> |
using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", inner.GetType().Name, inner.Message, System.Environment.NewLine, inner.ToString()))) |
63 |
> |
{ |
64 |
> |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
65 |
> |
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
66 |
> |
} |
67 |
> |
} |
68 |
> |
} |
69 |
> |
else |
70 |
> |
{ |
71 |
> |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
72 |
> |
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
73 |
> |
} |
74 |
|
} |
75 |
|
StringBuilder builder = new StringBuilder(); |
76 |
|
foreach (string str in strs) { builder.AppendLine(str); } |
83 |
|
List<string> strs = new List<string>(); |
84 |
|
using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", e.GetType().Name, e.Message, System.Environment.NewLine, e.ToString()))) |
85 |
|
{ |
86 |
< |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
87 |
< |
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
86 |
> |
Exception inner = e.InnerException; |
87 |
> |
if (inner != null) |
88 |
> |
{ |
89 |
> |
using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", inner.GetType().Name, inner.Message, System.Environment.NewLine, inner.ToString()))) |
90 |
> |
{ |
91 |
> |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
92 |
> |
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
93 |
> |
} |
94 |
> |
} |
95 |
> |
else |
96 |
> |
{ |
97 |
> |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
98 |
> |
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
99 |
> |
} |
100 |
|
} |
101 |
|
StringBuilder builder = new StringBuilder(); |
102 |
|
foreach (string str in strs) { builder.AppendLine(str); } |