[slf4j-dev] [GIT] SLF4J: Simple Logging Facade for Java branch, master, updated. v_1.6.1-35-g8a32939

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Thu Jul 7 22:35:54 CEST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".

The branch, master has been updated
       via  8a329393cca7f5723e76ab87c77f6e9f0dc37c4f (commit)
      from  d9e7175fb77832e2366a5755995bb14399f015fa (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=8a329393cca7f5723e76ab87c77f6e9f0dc37c4f
http://github.com/ceki/slf4j/commit/8a329393cca7f5723e76ab87c77f6e9f0dc37c4f

commit 8a329393cca7f5723e76ab87c77f6e9f0dc37c4f
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu Jul 7 22:27:13 2011 +0200

    fix bug 225

diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/BasicConfigurator.java
similarity index 56%
copy from log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java
copy to log4j-over-slf4j/src/main/java/org/apache/log4j/BasicConfigurator.java
index a9570ac..6dd9d57 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/BasicConfigurator.java
@@ -14,53 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.log4j;
 
-import java.util.Stack;
-
 /**
- * A bare-bones implementation of log4j's NDC which compiles and prevents run
- * time exceptions.
- * 
- * @since SLF4J 1.6.0
+ * A minimal (nop) implementation of BasicConfigurator.
  */
-
-public class NDC {
-
-  public static void clear() {
-  }
-
-  public static Stack cloneStack() {
-    return null;
-  }
-
-  public static void inherit(Stack stack) {
-  }
-
-  static public String get() {
-    return null;
-  }
-
-  public static int getDepth() {
-    return 0;
-  }
-
-  public static String pop() {
-    return "";
+public class BasicConfigurator {
+  public static void configure() {
   }
 
-  public static String peek() {
-    return "";
+  public static void configure(Appender appender) {
   }
 
-  public static void push(String message) {
+  public static void resetConfiguration() {
   }
-
-  static public void remove() {
-  }
-
-  static public void setMaxDepth(int maxDepth) {
-  }
-
 }
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java
index a9570ac..a2d0451 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java
@@ -17,18 +17,26 @@
 
 package org.apache.log4j;
 
+import org.slf4j.MDC;
+
 import java.util.Stack;
 
 /**
- * A bare-bones implementation of log4j's NDC which compiles and prevents run
- * time exceptions.
- * 
+ * A log4j's NDC implemented in terms of SLF4J MDC primitives.
+ *
  * @since SLF4J 1.6.0
  */
 
 public class NDC {
 
+  public final static String PREFIX = "NDC";
+
   public static void clear() {
+    int depth = getDepth();
+    for (int i = 0; i < depth; i++) {
+      String key = PREFIX + i;
+      MDC.remove(key);
+    }
   }
 
   public static Stack cloneStack() {
@@ -43,21 +51,48 @@ public class NDC {
   }
 
   public static int getDepth() {
-    return 0;
+    int i = 0;
+    while (true) {
+      String val = MDC.get(PREFIX + i);
+      if (val != null) {
+        i++;
+      } else {
+        break;
+      }
+    }
+    return i;
   }
 
   public static String pop() {
-    return "";
+    int next = getDepth();
+    if (next == 0) {
+      return "";
+    }
+    int last = next - 1;
+    String key = PREFIX + last;
+    String val = MDC.get(key);
+    MDC.remove(key);
+    return val;
   }
 
   public static String peek() {
-    return "";
+    int next = getDepth();
+    if (next == 0) {
+      return "";
+    }
+    int last = next - 1;
+    String key = PREFIX + last;
+    String val = MDC.get(key);
+    return val;
   }
 
   public static void push(String message) {
+    int next = getDepth();
+    MDC.put(PREFIX + next, message);
   }
 
   static public void remove() {
+    clear();
   }
 
   static public void setMaxDepth(int maxDepth) {
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/PropertyConfigurator.java
similarity index 52%
copy from log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java
copy to log4j-over-slf4j/src/main/java/org/apache/log4j/PropertyConfigurator.java
index a9570ac..9c0dc7c 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/PropertyConfigurator.java
@@ -14,53 +14,39 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.log4j;
 
-import java.util.Stack;
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.log4j.spi.Configurator;
+import org.apache.log4j.spi.LoggerRepository;
 
 /**
- * A bare-bones implementation of log4j's NDC which compiles and prevents run
- * time exceptions.
- * 
- * @since SLF4J 1.6.0
+ * An nop implementation of PropertyConfigurator.
  */
-
-public class NDC {
-
-  public static void clear() {
+public class PropertyConfigurator implements Configurator {
+  public static void configure(Properties properties) {
   }
 
-  public static Stack cloneStack() {
-    return null;
+  public static void configure(String configFilename) {
   }
 
-  public static void inherit(Stack stack) {
+  public static void configure(java.net.URL configURL) {
   }
 
-  static public String get() {
-    return null;
+  public static void configureAndWatch(String configFilename) {
   }
 
-  public static int getDepth() {
-    return 0;
+  public static void configureAndWatch(String configFilename, long delay) {
   }
 
-  public static String pop() {
-    return "";
+  public void doConfigure(Properties properties, LoggerRepository hierarchy) {
   }
 
-  public static String peek() {
-    return "";
+  public void doConfigure(String configFileName, LoggerRepository hierarchy) {
   }
 
-  public static void push(String message) {
+  public void doConfigure(URL configURL, LoggerRepository hierarchy) {
   }
-
-  static public void remove() {
-  }
-
-  static public void setMaxDepth(int maxDepth) {
-  }
-
 }
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/xml/DOMConfigurator.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/xml/DOMConfigurator.java
index 177feae..0fbd019 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/xml/DOMConfigurator.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/xml/DOMConfigurator.java
@@ -19,14 +19,48 @@ import org.apache.log4j.spi.Configurator;
 import org.apache.log4j.spi.LoggerRepository;
 
 import javax.xml.parsers.FactoryConfigurationError;
+import java.io.InputStream;
+import java.io.Reader;
 import java.net.URL;
+import java.util.Properties;
 
 
+import org.w3c.dom.Element;
+
 public class DOMConfigurator implements Configurator {
-    static  public void configure(URL url) throws FactoryConfigurationError {
-    }
 
+  public static void configure(Element element) {
+  }
+
+  public static void configure(String filename) throws FactoryConfigurationError {
+  }
+
+  static public void configure(URL url) throws FactoryConfigurationError {
+  }
+
+  static public void configureAndWatch(String configFilename) {
+  }
+
+  public static void configureAndWatch(String configFilename, long delay) {
+  }
+
+  public void doConfigure(Element element, LoggerRepository repository) {
+  }
+
+  public void doConfigure(InputStream inputStream, LoggerRepository repository) throws FactoryConfigurationError {
+  }
+
+  public void doConfigure(Reader reader, LoggerRepository repository) throws FactoryConfigurationError {
+  }
+
+  public void doConfigure(String filename, LoggerRepository repository) {
+  }
+
+  public void doConfigure(URL url, LoggerRepository repository) {
+  }
+
+  public static String subst(String value, Properties props) {
+    return value;
+  }
 
-    public void doConfigure(URL url, LoggerRepository repository) {
-    }
 }
diff --git a/log4j-over-slf4j/src/test/java/org/apache/log4j/NDCTest.java b/log4j-over-slf4j/src/test/java/org/apache/log4j/NDCTest.java
new file mode 100644
index 0000000..adaab9d
--- /dev/null
+++ b/log4j-over-slf4j/src/test/java/org/apache/log4j/NDCTest.java
@@ -0,0 +1,37 @@
+package org.apache.log4j;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Ceki G&uuml;c&uuml;
+ */
+public class NDCTest extends TestCase {
+
+
+  public void setUp() {
+    assertEquals(0, NDC.getDepth());
+  }
+
+  public void tearDown() {
+    NDC.clear();
+  }
+
+  public void testSmoke() {
+    NDC.push("a");
+    String back = NDC.pop();
+    assertEquals("a", back);
+  }
+
+  public void testPop() {
+    NDC.push("peek");
+    String back = NDC.peek();
+    assertEquals("peek", back);
+  }
+
+  public void testClear() {
+    NDC.push("clear");
+    NDC.clear();
+    assertEquals(0, NDC.getDepth());
+  }
+
+}
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index d42b4d4..a60a10e 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -29,6 +29,16 @@
 
    <hr noshade="noshade" size="1"/>
 
+   <h3>, 2011 - Release of SLF4J 1.6.2</h3>
+
+   <p>Added certain missing classes to the log4j-over-slf4j module as
+   requested in <a
+   href="http://bugzilla.slf4j.org/show_bug.cgi?id=225">bug 225</a> by
+   Josh Stewart.
+   </p>
+
+   <hr noshade="noshade" size="1"/>
+
    <h3>July 5th, 2010 - Release of SLF4J 1.6.1</h3>
 
    <p>Updated log4j dependency to version 1.2.16 and <a

-----------------------------------------------------------------------

Summary of changes:
 .../log4j/{NDC.java => BasicConfigurator.java}     |   45 ++-----------------
 .../src/main/java/org/apache/log4j/NDC.java        |   47 +++++++++++++++++---
 .../log4j/{NDC.java => PropertyConfigurator.java}  |   44 ++++++------------
 .../java/org/apache/log4j/xml/DOMConfigurator.java |   42 ++++++++++++++++--
 .../src/test/java/org/apache/log4j/NDCTest.java    |   37 +++++++++++++++
 slf4j-site/src/site/pages/news.html                |   10 ++++
 6 files changed, 146 insertions(+), 79 deletions(-)
 copy log4j-over-slf4j/src/main/java/org/apache/log4j/{NDC.java => BasicConfigurator.java} (56%)
 copy log4j-over-slf4j/src/main/java/org/apache/log4j/{NDC.java => PropertyConfigurator.java} (52%)
 create mode 100644 log4j-over-slf4j/src/test/java/org/apache/log4j/NDCTest.java


hooks/post-receive
-- 
SLF4J: Simple Logging Facade for Java


More information about the slf4j-dev mailing list