[logback-dev] svn commit: r2316 - in logback/trunk: logback-classic/src/main/java/ch/qos/logback/classic logback-classic/src/test/java/ch/qos/logback/classic logback-core/src/main/java/ch/qos/logback/core logback-core/src/test/java/ch/qos/logback/core logback-site/src/site/pages

noreply.ceki at qos.ch noreply.ceki at qos.ch
Thu Jul 2 15:56:34 CEST 2009


Author: ceki
Date: Thu Jul  2 15:56:33 2009
New Revision: 2316

Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
   logback/trunk/logback-core/src/test/java/ch/qos/logback/core/ContextBaseTest.java
   logback/trunk/logback-site/src/site/pages/news.html

Log:
Fixing LBCORE-104


Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java	Thu Jul  2 15:56:33 2009
@@ -60,10 +60,10 @@
 
   private LoggerContextVO loggerContextRemoteView;
   private final TurboFilterList turboFilterList = new TurboFilterList();
-  private boolean packagingDataEnabled = true; 
-  
+  private boolean packagingDataEnabled = true;
+
   private int maxCallerDataDepth = ClassicConstants.DEFAULT_MAX_CALLEDER_DATA_DEPTH;
-  
+
   boolean started = false;
 
   public LoggerContext() {
@@ -200,11 +200,14 @@
     return packagingDataEnabled;
   }
 
-  
   /**
-   * This method closes all appenders,
+   * This method clears all internal properties, closes all appenders, removes
+   * any turboFilters, fires an OnReset event, removes all status listeners,
+   * removes all context listeners (except those which are reset resistant).
    */
+  @Override
   public void reset() {
+    super.reset();
     root.recursiveReset();
     resetTurboFilterList();
     fireOnReset();
@@ -344,5 +347,5 @@
   public void setMaxCallerDataDepth(int maxCallerDataDepth) {
     this.maxCallerDataDepth = maxCallerDataDepth;
   }
-  
+
 }

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java	Thu Jul  2 15:56:33 2009
@@ -191,6 +191,17 @@
   }
   
   @Test
+  public void resetTest_LBCORE_104() {
+    lc.putProperty("keyA", "valA");
+    lc.putObject("keyA", "valA");
+    assertEquals("valA", lc.getProperty("keyA"));
+    assertEquals("valA", lc.getObject("keyA"));
+    lc.reset();
+    assertNull(lc.getProperty("keyA"));
+    assertNull(lc.getObject("keyA"));
+  }
+  
+  @Test
   public void levelResetTest() {
     Logger root = lc.getLogger(LoggerContext.ROOT_NAME);
     root.setLevel(Level.TRACE);

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java	Thu Jul  2 15:56:33 2009
@@ -74,6 +74,14 @@
   }
 
   /**
+   * Clear the internal objectMap and all properties.
+   */
+  public void reset() {
+    propertyMap.clear();
+    objectMap.clear();
+  }
+
+  /**
    * The context name can be set only if it is not already set, or if the
    * current name is the default context name, namely "default", or if the
    * current name and the old name are the same.

Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/ContextBaseTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/ContextBaseTest.java	(original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/ContextBaseTest.java	Thu Jul  2 15:56:33 2009
@@ -9,6 +9,8 @@
  */
 package ch.qos.logback.core;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
 import org.junit.Test;
@@ -40,4 +42,15 @@
     }
   }
 
+  @Test
+  public void resetTest() {
+    context.setName("hello");
+    context.putProperty("keyA", "valA");
+    context.putObject("keyA", "valA");
+    assertEquals("valA", context.getProperty("keyA"));
+    assertEquals("valA", context.getObject("keyA"));
+    context.reset();
+    assertNull(context.getProperty("keyA"));
+    assertNull(context.getObject("keyA"));
+  }
 }

Modified: logback/trunk/logback-site/src/site/pages/news.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/news.html	(original)
+++ logback/trunk/logback-site/src/site/pages/news.html	Thu Jul  2 15:56:33 2009
@@ -29,7 +29,17 @@
 
     <hr width="80%" align="center" />
 
-    <h3>Nth of April 2009 - Release of version 0.9.16</h3>
+    <h3>Nth of July 2009 - Release of version 0.9.16</h3>
+
+    <p>In logback-classic, <a
+    href="xref/ch/qos/logback/classic/spi/LoggingEvent.html"><code>LoggingEvent</code></a>
+    now implements the <a
+    href="xref/ch/qos/logback/classic/spi/ILoggingEvent.html"><code>ILoggingEvent</code></a>
+    interface. All logback-classic components expect to process
+    <code>ILoggingEvent</code> intances. Moreover, events which sent
+    to a remote host are now of type <a
+    href="xref/ch/qos/logback/classic/spi/LoggingEventVO.html"><code>LoggingEventVO</code></a>.
+    </p>
 
     <p>Fixed a bug in the localLevelReset() method in the
     <code>Logger</code> class whcih inadvertently used the DEBUG_INT
@@ -54,6 +64,12 @@
     href="http://jira.qos.ch/browse/LBCLASSIC-117">LBCLASSIC-117</a>
     by Rick Janda.
     </p>
+    
+    <p>When a context is reset, then its object and property maps are
+    now cleared. This fixes <a
+    href="http://jira.qos.ch/browse/LBCORE-104">LBCORE-104</a>
+    reported by Johan Bos.
+    </p>
 
     <hr width="80%" align="center" />
 


More information about the logback-dev mailing list