/[AnywhereTS-MSSQL]/trunk/AnywhereTS.Logging/Logging.cs
ViewVC logotype

Diff of /trunk/AnywhereTS.Logging/Logging.cs

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

--- trunk/AnywhereTS.Logging/Logging.cs	2012/07/12 20:47:35	70
+++ trunk/AnywhereTS.Logging/Logging.cs	2012/07/13 21:13:27	86
@@ -18,6 +18,7 @@
         #region Log access
         public static readonly ILog ATSAdminLog = LogManager.GetLogger("AnywhereTS.ATSAmdin");
         public static readonly ILog TSControlPanelLog = LogManager.GetLogger("AnywhereTS.TSControlPanel");
+        public static readonly ILog DatabaseLog = LogManager.GetLogger("AnywhereTS.DBSupport");
         #endregion
 
         #region log4net help
@@ -29,24 +30,28 @@
                 if (tc == null) { return new List<string>(); }
                 else { return GetMessagesFromThreadContextStack(tc); }
             }
-            catch { return new List<string>(); }            
+            catch { return new List<string>(); }
         }
         public static List<string> GetMessagesFromThreadContextStack(ThreadContextStack rawTCS)
         {
-            ThreadContextStack oldrawTCS = rawTCS;
-            List<string> stack_objects = new List<string>();
-           
-                ThreadContextStack context = (rawTCS as ThreadContextStack);
-                for (int i = 0; i < context.Count; i++)
-                {
-                    Type t = typeof(ThreadContextStack);
-                    MethodInfo mi = t.GetMethod("GetFullMessage", BindingFlags.NonPublic | BindingFlags.Instance);
-                    string message = mi.Invoke(context, null).ToString();
-                    stack_objects.Add(message);
-                    context.Pop();
-                }
-                rawTCS = oldrawTCS;            
-            return stack_objects;
+            Type t = typeof(ThreadContextStack);
+            //ConstructorInfo ci = t.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[0], null);
+            //ThreadContextStack tmpRawTCS = null;
+            //tmpRawTCS = (ThreadContextStack)ci.Invoke(null);
+            List<string> stObjects = new List<string>();
+            ThreadContextStack context = (rawTCS as ThreadContextStack);
+            for (int i = 0; i < context.Count; i++)
+            {
+                MethodInfo mi = t.GetMethod("GetFullMessage", BindingFlags.NonPublic | BindingFlags.Instance);
+                string message = mi.Invoke(context, null).ToString();
+                stObjects.Add(message);
+                context.Pop();
+            }
+            stObjects.Reverse();
+            rawTCS.Clear();
+            // push the popped Context message back onto the original ContextStack
+            foreach (string stObject in stObjects) { rawTCS.Push(stObject); }
+            return stObjects;
         }
         #endregion
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22