logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1165671 - in /logging/log4net/trunk/tests/src: LoggerRepository/ConfigurationMessages.cs Util/LogLogTest.cs
Date Tue, 06 Sep 2011 13:55:10 GMT
Author: bodewig
Date: Tue Sep  6 13:55:09 2011
New Revision: 1165671

URL: http://svn.apache.org/viewvc?rev=1165671&view=rev
Log:
ensure tests reset static LogLog configuration if they change it.  Fixes the two LogLog tests
that are part of the ten failing tests in LOG4NET-301

Modified:
    logging/log4net/trunk/tests/src/LoggerRepository/ConfigurationMessages.cs
    logging/log4net/trunk/tests/src/Util/LogLogTest.cs

Modified: logging/log4net/trunk/tests/src/LoggerRepository/ConfigurationMessages.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/LoggerRepository/ConfigurationMessages.cs?rev=1165671&r1=1165670&r2=1165671&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/LoggerRepository/ConfigurationMessages.cs (original)
+++ logging/log4net/trunk/tests/src/LoggerRepository/ConfigurationMessages.cs Tue Sep  6 13:55:09
2011
@@ -37,11 +37,12 @@ namespace log4net.Tests.LoggerRepository
         [Test]
         public void ConfigurationMessagesTest()
         {
-            LogLog.EmitInternalMessages = false;
-            LogLog.InternalDebugging = true;
+            try {
+                LogLog.EmitInternalMessages = false;
+                LogLog.InternalDebugging = true;
 
-            XmlDocument log4netConfig = new XmlDocument();
-            log4netConfig.LoadXml(@"
+                XmlDocument log4netConfig = new XmlDocument();
+                log4netConfig.LoadXml(@"
                 <log4net>
                   <appender name=""LogLogAppender"" type=""log4net.Tests.LoggerRepository.LogLogAppender,
log4net.Tests"">
                     <layout type=""log4net.Layout.SimpleLayout"" />
@@ -56,12 +57,17 @@ namespace log4net.Tests.LoggerRepository
                   </root>  
                 </log4net>");
 
-            ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
-            rep.ConfigurationChanged += new LoggerRepositoryConfigurationChangedEventHandler(rep_ConfigurationChanged);
+                ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
+                rep.ConfigurationChanged += new LoggerRepositoryConfigurationChangedEventHandler(rep_ConfigurationChanged);
 
-            ICollection configurationMessages = XmlConfigurator.Configure(rep, log4netConfig["log4net"]);
+                ICollection configurationMessages = XmlConfigurator.Configure(rep, log4netConfig["log4net"]);
 
-            Assert.IsTrue(configurationMessages.Count > 0);
+                Assert.IsTrue(configurationMessages.Count > 0);
+            }
+            finally {
+                LogLog.EmitInternalMessages = true;
+                LogLog.InternalDebugging = false;
+            }
         }
 
         static void rep_ConfigurationChanged(object sender, EventArgs e)

Modified: logging/log4net/trunk/tests/src/Util/LogLogTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Util/LogLogTest.cs?rev=1165671&r1=1165670&r2=1165671&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Util/LogLogTest.cs (original)
+++ logging/log4net/trunk/tests/src/Util/LogLogTest.cs Tue Sep  6 13:55:09 2011
@@ -54,11 +54,16 @@ namespace log4net.Tests.Util
             Trace.Flush();
             Assert.AreEqual(2, listTraceListener.Count);
 
-            LogLog.EmitInternalMessages = false;
+            try {
+                LogLog.EmitInternalMessages = false;
 
-            LogLog.Error(GetType(), "Hello");
-            LogLog.Error(GetType(), "World");
-            Assert.AreEqual(2, listTraceListener.Count);
+                LogLog.Error(GetType(), "Hello");
+                LogLog.Error(GetType(), "World");
+                Assert.AreEqual(2, listTraceListener.Count);
+            }
+            finally {
+                LogLog.EmitInternalMessages = true;
+            }
         }
 
         [Test]



Mime
View raw message