4 |
|
using System.Data.SqlClient; |
5 |
|
using System.Collections; |
6 |
|
using System.Text; |
7 |
+ |
using log4net; |
8 |
|
|
9 |
|
namespace AnywhereTS |
10 |
|
{ |
46 |
|
if (e.GetType() == typeof(SqlException)) |
47 |
|
{ |
48 |
|
SqlException sql_ex = (e as SqlException); |
49 |
< |
List<object> strs = new List<object>(); |
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 |
< |
Stack stack = log4net.NDC.CloneStack(); |
53 |
< |
strs = new List<object>(stack.ToArray()); |
53 |
< |
strs.Reverse(); |
54 |
< |
Logging.TSControlPanelLog.Error("Encountered unhandled Exception"); |
52 |
> |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
53 |
> |
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
54 |
|
} |
55 |
|
StringBuilder builder = new StringBuilder(); |
56 |
< |
foreach (object str in strs) { builder.AppendLine(str.ToString()); } |
56 |
> |
foreach (string str in strs) { builder.AppendLine(str); } |
57 |
|
result = ShowAbortRetryIgnoreDialog("Encountered unhandled Exception", builder.ToString()); |
58 |
|
if (result == DialogResult.Abort) |
59 |
|
Application.Exit(); |
60 |
|
} |
61 |
|
else |
62 |
|
{ |
63 |
< |
List<object> strs = new List<object>(); |
63 |
> |
List<string> strs = new List<string>(); |
64 |
|
using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", e.GetType().Name, e.Message, System.Environment.NewLine, e.ToString()))) |
65 |
|
{ |
66 |
< |
Stack stack = log4net.NDC.CloneStack(); |
67 |
< |
strs = new List<object>(stack.ToArray()); |
68 |
< |
strs.Reverse(); |
70 |
< |
Logging.TSControlPanelLog.Error("Encountered unhandled Exception"); |
71 |
< |
} |
66 |
> |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
67 |
> |
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
68 |
> |
} |
69 |
|
StringBuilder builder = new StringBuilder(); |
70 |
< |
foreach (object str in strs) { builder.AppendLine(str.ToString()); } |
70 |
> |
foreach (string str in strs) { builder.AppendLine(str); } |
71 |
|
result = ShowAbortRetryIgnoreDialog("Encountered unhandled Exception", builder.ToString()); |
72 |
|
if (result == DialogResult.Abort) |
73 |
|
Application.Exit(); |