Repository: logging-chainsaw
Updated Branches:
  refs/heads/log4j-2 [created] deb3b3c04


http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/main/java/org/apache/log4j/spi/RendererSupport.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/log4j/spi/RendererSupport.java 
b/src/main/java/org/apache/log4j/spi/RendererSupport.java
new file mode 100644
index 0000000..9d69faa
--- /dev/null
+++ b/src/main/java/org/apache/log4j/spi/RendererSupport.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.log4j.spi;
+
+import org.apache.log4j.or.ObjectRenderer;
+import org.apache.log4j.or.RendererMap;
+
+
+public interface RendererSupport {
+
+  public
+  RendererMap getRendererMap();
+
+  public
+  void setRenderer(Class renderedClass, ObjectRenderer renderer);
+
+}

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/main/java/org/apache/log4j/spi/Thresholdable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/log4j/spi/Thresholdable.java 
b/src/main/java/org/apache/log4j/spi/Thresholdable.java
index 222345f..b85bfb2 100644
--- a/src/main/java/org/apache/log4j/spi/Thresholdable.java
+++ b/src/main/java/org/apache/log4j/spi/Thresholdable.java
@@ -17,7 +17,7 @@
 
 package org.apache.log4j.spi;
 
-import org.apache.log4j.Level;
+import org.apache.logging.log4j.Level;
 
 /**
  * An interface that defines the required methods for supporting the
@@ -32,7 +32,7 @@ import org.apache.log4j.Level;
  */
 public interface Thresholdable {
     /**
-     * Sets the component theshold to the given level.
+     * Sets the component threshold to the given level.
      *
      * @param level The threshold level events must equal or be greater
      *              than before further processing can be done.

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/main/java/org/apache/log4j/varia/ListModelAppender.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/log4j/varia/ListModelAppender.java 
b/src/main/java/org/apache/log4j/varia/ListModelAppender.java
index ccbc9be..55bea90 100644
--- a/src/main/java/org/apache/log4j/varia/ListModelAppender.java
+++ b/src/main/java/org/apache/log4j/varia/ListModelAppender.java
@@ -17,8 +17,8 @@
 
 package org.apache.log4j.varia;
 
-import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
 
 import javax.swing.DefaultListModel;
 import javax.swing.ListModel;
@@ -32,17 +32,17 @@ import javax.swing.ListModel;
  * @author Paul Smith (psm...@apache.org)
  *
  */
-public final class ListModelAppender extends AppenderSkeleton {
+public final class ListModelAppender extends AbstractAppender {
     /**
      * Default list model.
      */
-  private final DefaultListModel model = new DefaultListModel();
+  private final DefaultListModel<LogEvent> model = new DefaultListModel<>();
 
   /**
    * Constructs a ListModelAppender.
    */
   public ListModelAppender() {
-      super(true);
+    super("ListModelAppender", null, null);
   }
   /**
    * Returns a reference to the ListModel that contains all the LoggingEvents
@@ -54,13 +54,11 @@ public final class ListModelAppender extends 
AppenderSkeleton {
     return model;
   }
 
-    /** {@inheritDoc} */
-  protected void append(final LoggingEvent event) {
+  public void append(final LogEvent event) {
     model.addElement(event);
   }
 
-    /** {@inheritDoc} */
-  public void close() {
+  public void stop() {
     clearModel();
   }
 
@@ -71,9 +69,4 @@ public final class ListModelAppender extends AppenderSkeleton 
{
     model.clear();
   }
 
-    /** {@inheritDoc} */
-  public boolean requiresLayout() {
-      return false;
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/main/java/org/apache/log4j/xml/SAXErrorHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/log4j/xml/SAXErrorHandler.java 
b/src/main/java/org/apache/log4j/xml/SAXErrorHandler.java
new file mode 100644
index 0000000..bd96582
--- /dev/null
+++ b/src/main/java/org/apache/log4j/xml/SAXErrorHandler.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.xml;
+
+import org.apache.logging.log4j.status.StatusLogger;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXParseException;
+
+public class SAXErrorHandler implements ErrorHandler {
+
+  private final StatusLogger statusLogger = StatusLogger.getLogger();
+
+  public
+  void error(final SAXParseException ex) {
+    emitMessage("Continuable parsing error ", ex);
+  }
+  
+  public
+  void fatalError(final SAXParseException ex) {
+    emitMessage("Fatal parsing error ", ex);
+  }
+   
+  public
+  void warning(final SAXParseException ex) {
+    emitMessage("Parsing warning ", ex);
+  }
+  
+  private void emitMessage(final String msg, final SAXParseException ex) {
+    statusLogger.warn(msg +ex.getLineNumber()+" and column "
+                +ex.getColumnNumber());
+    statusLogger.warn(ex.getMessage(), ex.getException());
+  }
+}

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/main/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java 
b/src/main/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java
index f9d8125..cba9295 100644
--- a/src/main/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java
+++ b/src/main/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java
@@ -37,13 +37,11 @@ import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Logger;
 import org.apache.log4j.helpers.UtilLoggingLevel;
 import org.apache.log4j.spi.Decoder;
-import org.apache.log4j.spi.LoggingEvent;
-import org.apache.log4j.spi.ThrowableInformation;
-import org.apache.log4j.spi.LocationInfo;
+import org.apache.logging.log4j.core.LogEvent;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -77,7 +75,7 @@ public class UtilLoggingXMLDecoder implements Decoder {
     /**
      * Additional properties.
      */
-  private Map additionalProperties = new HashMap();
+  private Map<String, String> additionalProperties = new HashMap<>();
     /**
      * Partial event.
      */
@@ -120,17 +118,17 @@ public class UtilLoggingXMLDecoder implements Decoder {
 
   /**
    * Sets an additionalProperty map, where each Key/Value pair is
-   * automatically added to each LoggingEvent as it is decoded.
+   * automatically added to each LogEvent as it is decoded.
    *
    * This is useful, say, to include the source file name of the Logging events
    * @param properties additional properties
    */
-  public void setAdditionalProperties(final Map properties) {
+  public void setAdditionalProperties(final Map<String, String> properties) {
     this.additionalProperties = properties;
   }
 
   /**
-   * Converts the LoggingEvent data in XML string format into an actual
+   * Converts the LogEvent data in XML string format into an actual
    * XML Document class instance.
    * @param data XML fragment
    * @return  dom document
@@ -180,7 +178,7 @@ public class UtilLoggingXMLDecoder implements Decoder {
    * @return Vector of LoggingEvents
    * @throws IOException if IO error during processing.
    */
-  public Vector decode(final URL url) throws IOException {
+  public Vector<LogEvent> decode(final URL url) throws IOException {
     LineNumberReader reader;
     boolean isZipFile = url.getPath().toLowerCase().endsWith(".zip");
     InputStream inputStream;
@@ -199,10 +197,10 @@ public class UtilLoggingXMLDecoder implements Decoder {
     } else {
         reader = new LineNumberReader(new InputStreamReader(inputStream, 
ENCODING));
     }
-    Vector v = new Vector();
+    Vector<LogEvent> v = new Vector<>();
 
       String line;
-      Vector events;
+      Vector<LogEvent> events;
       try {
           while ((line = reader.readLine()) != null) {
               StringBuffer buffer = new StringBuffer(line);
@@ -233,7 +231,7 @@ public class UtilLoggingXMLDecoder implements Decoder {
    * @param document to decode events from
    * @return Vector of LoggingEvents
    */
-  public Vector decodeEvents(final String document) {
+  public Vector<LogEvent> decodeEvents(final String document) {
 
       if (document != null) {
 
@@ -279,22 +277,22 @@ public class UtilLoggingXMLDecoder implements Decoder {
 
     /**
       * Converts the string data into an XML Document, and then soaks out the
-      * relevant bits to form a new LoggingEvent instance which can be used
+      * relevant bits to form a new LogEvent instance which can be used
       * by any Log4j element locally.
       * @param data XML fragment
-      * @return a single LoggingEvent or null
+      * @return a single LogEvent or null
       */
-  public LoggingEvent decode(final String data) {
+  public LogEvent decode(final String data) {
     Document document = parse(data);
 
     if (document == null) {
       return null;
     }
 
-    Vector events = decodeEvents(document);
+    Vector<LogEvent> events = decodeEvents(document);
 
     if (events.size() > 0) {
-      return (LoggingEvent) events.firstElement();
+      return events.firstElement();
     }
 
     return null;
@@ -305,8 +303,8 @@ public class UtilLoggingXMLDecoder implements Decoder {
    * @param document XML document
    * @return Vector of LoggingEvents
    */
-  private Vector decodeEvents(final Document document) {
-    Vector events = new Vector();
+  private Vector<LogEvent> decodeEvents(final Document document) {
+    Vector<LogEvent> events = new Vector<>();
 
     NodeList eventList = document.getElementsByTagName("record");
 
@@ -325,7 +323,7 @@ public class UtilLoggingXMLDecoder implements Decoder {
     String methodName = null;
     String fileName = null;
     String lineNumber = null;
-    Hashtable properties = new Hashtable();
+    Hashtable<String, String> properties = new Hashtable<>();
 
       //format of date: 2003-05-04T11:04:52
       //ignore date or set as a property? using millis in constructor instead
@@ -372,7 +370,7 @@ public class UtilLoggingXMLDecoder implements Decoder {
         }
 
         if (tagName.equalsIgnoreCase("exception")) {
-          ArrayList exceptionList = new ArrayList();
+          ArrayList<String> exceptionList = new ArrayList<>();
           NodeList exList = list.item(y).getChildNodes();
           int exlistLength = exList.getLength();
 
@@ -394,35 +392,33 @@ public class UtilLoggingXMLDecoder implements Decoder {
             }
           }
           if (exceptionList.size() > 0) {
-              exception =
-                (String[]) exceptionList.toArray(new 
String[exceptionList.size()]);
+              exception = exceptionList.toArray(new 
String[exceptionList.size()]);
           }
         }
       }
 
-        /**
+        /*
          * We add all the additional properties to the properties
          * hashtable. Override properties that already exist
          */
         if (additionalProperties.size() > 0) {
             if (properties == null) {
-                properties = new Hashtable(additionalProperties);
+                properties = new Hashtable<String, 
String>(additionalProperties);
             }
-            Iterator i = additionalProperties.entrySet().iterator();
-            while (i.hasNext()) {
-                Map.Entry e = (Map.Entry) i.next();
+            for (Object o : additionalProperties.entrySet()) {
+                Map.Entry e = (Map.Entry)o;
                 properties.put(e.getKey(), e.getValue());
             }
         }
 
-      LocationInfo info;
+      StackTraceElement info;
       if ((fileName != null)
               || (className != null)
               || (methodName != null)
               || (lineNumber != null)) {
-          info = new LocationInfo(fileName, className, methodName, lineNumber);
+          info = new StackTraceElement(fileName, className, methodName, 
Integer.parseInt(lineNumber));
       } else {
-        info = LocationInfo.NA_LOCATION_INFO;
+        info = null;
       }
 
         ThrowableInformation throwableInfo = null;
@@ -430,7 +426,7 @@ public class UtilLoggingXMLDecoder implements Decoder {
             throwableInfo = new ThrowableInformation(exception);
         }
 
-        LoggingEvent loggingEvent = new LoggingEvent(null,
+        LogEvent loggingEvent = new LogEvent(null,
                 logger, timeStamp, level, message,
                 threadName,
                 throwableInfo,
@@ -450,7 +446,7 @@ public class UtilLoggingXMLDecoder implements Decoder {
      * @return text content of all text or CDATA children of node.
      */
   private String getCData(final Node n) {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     NodeList nl = n.getChildNodes();
 
     for (int x = 0; x < nl.getLength(); x++) {

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/main/java/org/apache/log4j/xml/XMLDecoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/log4j/xml/XMLDecoder.java 
b/src/main/java/org/apache/log4j/xml/XMLDecoder.java
index 8ced851..dd9ca36 100644
--- a/src/main/java/org/apache/log4j/xml/XMLDecoder.java
+++ b/src/main/java/org/apache/log4j/xml/XMLDecoder.java
@@ -36,12 +36,13 @@ import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.log4j.spi.Decoder;
-import org.apache.log4j.spi.LocationInfo;
-import org.apache.log4j.spi.LoggingEvent;
-import org.apache.log4j.spi.ThrowableInformation;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.impl.Log4jLogEvent;
+import org.apache.logging.log4j.core.impl.ThrowableProxy;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -49,13 +50,13 @@ import org.xml.sax.InputSource;
 
 
 /**
- * Decodes Logging Events in XML formated into elements that are used by
+ * Decodes Log4j 1.2 XML formatted log events into elements that are used by
  * Chainsaw.
  *
  * This decoder can process a collection of log4j:event nodes ONLY
  * (no XML declaration nor eventSet node)
  *
- * NOTE:  Only a single LoggingEvent is returned from the decode method
+ * NOTE:  Only a single LogEvent is returned from the decode method
  * even though the DTD supports multiple events nested in an eventSet.
  *
  * NOTE: This class has been created on the assumption that all XML log files
@@ -94,7 +95,7 @@ public class XMLDecoder implements Decoder {
     /**
      * Additional properties.
      */
-  private Map additionalProperties = new HashMap();
+  private Map<String, String> additionalProperties = new HashMap<>();
     /**
      * Partial event.
      */
@@ -123,7 +124,6 @@ public class XMLDecoder implements Decoder {
     try {
       docBuilder = dbf.newDocumentBuilder();
       docBuilder.setErrorHandler(new SAXErrorHandler());
-      docBuilder.setEntityResolver(new Log4jEntityResolver());
     } catch (ParserConfigurationException pce) {
       System.err.println("Unable to get document builder");
     }
@@ -131,17 +131,17 @@ public class XMLDecoder implements Decoder {
 
   /**
    * Sets an additionalProperty map, where each Key/Value pair is
-   * automatically added to each LoggingEvent as it is decoded.
+   * automatically added to each LogEvent as it is decoded.
    *
    * This is useful, say, to include the source file name of the Logging events
    * @param properties additional properties
    */
-  public void setAdditionalProperties(final Map properties) {
+  public void setAdditionalProperties(final Map<String, String> properties) {
     this.additionalProperties = properties;
   }
 
   /**
-   * Converts the LoggingEvent data in XML string format into an actual
+   * Converts the LogEvent data in XML string format into an actual
    * XML Document class instance.
    * @param data XML fragment
    * @return dom document
@@ -158,7 +158,7 @@ public class XMLDecoder implements Decoder {
       // causes Crimson to barf. The Log4jEntityResolver only cares
       // about the "log4j.dtd" ending.
 
-      /**
+      /*
        * resetting the length of the StringBuffer is dangerous, particularly
        * on some JDK 1.4 impls, there's a known Bug that causes a memory leak
        */
@@ -184,7 +184,7 @@ public class XMLDecoder implements Decoder {
    * @return Vector of LoggingEvents
    * @throws IOException if IO error during processing.
    */
-  public Vector decode(final URL url) throws IOException {
+  public Vector<LogEvent> decode(final URL url) throws IOException {
     LineNumberReader reader;
     boolean isZipFile = url.getPath().toLowerCase().endsWith(".zip");
     InputStream inputStream;
@@ -204,10 +204,10 @@ public class XMLDecoder implements Decoder {
         reader = new LineNumberReader(new InputStreamReader(inputStream, 
ENCODING));
     }
 
-    Vector v = new Vector();
+    Vector<LogEvent> v = new Vector<>();
 
     String line;
-    Vector events;
+    Vector<LogEvent> events;
     try {
         while ((line = reader.readLine()) != null) {
             StringBuffer buffer = new StringBuffer(line);
@@ -238,7 +238,7 @@ public class XMLDecoder implements Decoder {
      * @param document to decode events from
      * @return Vector of LoggingEvents
      */
-  public Vector decodeEvents(final String document) {
+  public Vector<LogEvent> decodeEvents(final String document) {
     if (document != null) {
       if (document.trim().equals("")) {
         return null;
@@ -281,12 +281,12 @@ public class XMLDecoder implements Decoder {
 
   /**
    * Converts the string data into an XML Document, and then soaks out the
-   * relevant bits to form a new LoggingEvent instance which can be used
+   * relevant bits to form a new LogEvent instance which can be used
    * by any Log4j element locally.
    * @param data XML fragment
-   * @return a single LoggingEvent or null
+   * @return a single LogEvent or null
    */
-  public LoggingEvent decode(final String data) {
+  public LogEvent decode(final String data) {
     Document document = parse(data);
 
     if (document == null) {
@@ -296,7 +296,7 @@ public class XMLDecoder implements Decoder {
     Vector events = decodeEvents(document);
 
     if (events.size() > 0) {
-      return (LoggingEvent) events.firstElement();
+      return (LogEvent) events.firstElement();
     }
 
     return null;
@@ -307,8 +307,8 @@ public class XMLDecoder implements Decoder {
    * @param document XML document
    * @return Vector of LoggingEvents
    */
-  private Vector decodeEvents(final Document document) {
-    Vector events = new Vector();
+  private Vector<LogEvent> decodeEvents(final Document document) {
+    Vector<LogEvent> events = new Vector<>();
 
     Logger logger;
     long timeStamp;
@@ -335,7 +335,7 @@ public class XMLDecoder implements Decoder {
         if (eventNode.getNodeType() != Node.ELEMENT_NODE) {
             continue;
         }
-      logger = 
Logger.getLogger(eventNode.getAttributes().getNamedItem("logger").getNodeValue());
+      logger = 
LogManager.getLogger(eventNode.getAttributes().getNamedItem("logger").getNodeValue());
       timeStamp = 
Long.parseLong(eventNode.getAttributes().getNamedItem("timestamp").getNodeValue());
       level = 
Level.toLevel(eventNode.getAttributes().getNamedItem("level").getNodeValue());
       threadName = 
eventNode.getAttributes().getNamedItem("thread").getNodeValue();
@@ -433,21 +433,21 @@ public class XMLDecoder implements Decoder {
           }
       }
 
-      LocationInfo info;
+      StackTraceElement info;
       if ((fileName != null)
               || (className != null)
               || (methodName != null)
               || (lineNumber != null)) {
-          info = new LocationInfo(fileName, className, methodName, lineNumber);
+          info = new StackTraceElement(fileName, className, methodName, 
Integer.parseInt(lineNumber));
       } else {
-        info = LocationInfo.NA_LOCATION_INFO;
+        info = null;
       }
-      ThrowableInformation throwableInfo = null;
+      ThrowableProxy throwableInfo = null;
       if (exception != null) {
-          throwableInfo = new ThrowableInformation(exception);
+          throwableInfo = new ThrowableProxy(exception);
       }
 
-        LoggingEvent loggingEvent = new LoggingEvent(null,
+        LogEvent loggingEvent = new Log4jLogEvent(null,
                 logger, timeStamp, level, message,
                 threadName,
                 throwableInfo,

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java 
b/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java
deleted file mode 100644
index f15700d..0000000
--- a/src/test/java/org/apache/log4j/rewrite/RewriteAppenderTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.log4j.rewrite;
-
-import junit.framework.*;
-import org.apache.log4j.*;
-import org.apache.log4j.util.Compare;
-import org.apache.log4j.xml.*;
-
-import java.io.InputStream;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.TreeMap;
-import java.util.Hashtable;
-import javax.xml.parsers.*;
-import org.w3c.dom.*;
-
-public class RewriteAppenderTest extends TestCase {
-    public RewriteAppenderTest(final String name) {
-        super(name);
-    }
-
-    public void setUp() {
-        LogManager.getLoggerRepository().resetConfiguration();
-        Hashtable context = MDC.getContext();
-        if (context != null) {
-            context.clear();
-        }
-    }
-
-    public void tearDown() {
-        LogManager.getLoggerRepository().shutdown();
-    }
-
-    public void configure(final String resourceName) throws Exception {
-        InputStream is = 
RewriteAppenderTest.class.getResourceAsStream(resourceName);
-        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        factory.setNamespaceAware(false);
-        DocumentBuilder builder = factory.newDocumentBuilder();
-        Document doc = builder.parse(is);
-        DOMConfigurator.configure(doc.getDocumentElement());
-    }
-
-
-    public void testMapPolicy() throws Exception {
-        configure("map.xml");
-        Logger logger = Logger.getLogger(RewriteAppenderTest.class);
-        logger.info("Message 0");
-        MDC.put("p1", "Hola");
-
-        Map msg = new TreeMap();
-        msg.put("p1", "Hello");
-        msg.put("p2", "World");
-        msg.put("x1", "Mundo");
-        logger.info(msg);
-        msg.put("message", "Message 1");
-        logger.info(msg);
-        assertTrue(Compare.compare(RewriteAppenderTest.class, "temp", 
"map.log"));
-    }
-
-    private static class BaseBean {
-        private final Object p2;
-        private final Object x1;
-
-        public BaseBean(final Object p2,
-                        final Object x1) {
-             this.p2 = p2;
-             this.x1 = x1;
-        }
-
-        public Object getP2() {
-            return p2;
-        }
-
-        public Object getX1() {
-            return x1;
-        }
-
-        public String toString() {
-            return "I am bean.";
-        }
-    }
-
-    private static class MessageBean extends BaseBean {
-        private final Object msg;
-
-        public MessageBean(final Object msg,
-                           final Object p2,
-                           final Object x1) {
-            super(p2, x1);
-            this.msg = msg;
-        }
-
-        public Object getMessage() {
-            return msg;
-        }
-    }
-
-    public void testReflectionPolicy() throws Exception {
-        configure("reflection.xml");
-        Logger logger = Logger.getLogger(RewriteAppenderTest.class);
-        logger.info("Message 0");
-        logger.info(new BaseBean("Hello", "World" ));
-        MDC.put("p1", "Hola");
-        MDC.put("p2", "p2");
-        logger.info(new MessageBean("Welcome to The Hub", "Hello", "World" ));
-        assertTrue(Compare.compare(RewriteAppenderTest.class, "temp", 
"reflection.log"));
-    }
-
-    public void testPropertyPolicy() throws Exception {
-        configure("property.xml");
-        Logger logger = Logger.getLogger(RewriteAppenderTest.class);
-        logger.info("Message 0");
-        MDC.put("p1", "Hola");
-        logger.info("Message 1");
-        assertTrue(Compare.compare(RewriteAppenderTest.class, "temp", 
"property.log"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/test/resources/org/apache/log4j/rewrite/map.log
----------------------------------------------------------------------
diff --git a/src/test/resources/org/apache/log4j/rewrite/map.log 
b/src/test/resources/org/apache/log4j/rewrite/map.log
deleted file mode 100644
index 3ce933f..0000000
--- a/src/test/resources/org/apache/log4j/rewrite/map.log
+++ /dev/null
@@ -1,3 +0,0 @@
-INFO org.apache.log4j.rewrite.RewriteAppenderTest - p1: p2: Message 0
-INFO org.apache.log4j.rewrite.RewriteAppenderTest - p1:Hello p2:World 
{p1=Hello, p2=World, x1=Mundo}
-INFO org.apache.log4j.rewrite.RewriteAppenderTest - p1:Hello p2:World Message 1

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/test/resources/org/apache/log4j/rewrite/map.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/org/apache/log4j/rewrite/map.xml 
b/src/test/resources/org/apache/log4j/rewrite/map.xml
deleted file mode 100644
index 7cb60b7..0000000
--- a/src/test/resources/org/apache/log4j/rewrite/map.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements.  See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
-    <appender name="F1" class="org.apache.log4j.FileAppender">
-        <param name="file"   value="temp"/>
-        <param name="append" value="false"/>
-        <layout class="org.apache.log4j.PatternLayout">
-           <param name="ConversionPattern" value="%p %c - p1:%X{p1} p2:%X{p2} 
%m%n"/>
-        </layout>
-    </appender>
-
-
-  <appender name="A1" class="org.apache.log4j.rewrite.RewriteAppender">
-      <appender-ref ref="F1"/>
-      <rewritePolicy class="org.apache.log4j.rewrite.MapRewritePolicy"/>
-  </appender>
-
-  <root>
-    <level value ="debug" />
-    <appender-ref ref="A1" />
-  </root>
-
-</log4j:configuration>

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/test/resources/org/apache/log4j/rewrite/property.log
----------------------------------------------------------------------
diff --git a/src/test/resources/org/apache/log4j/rewrite/property.log 
b/src/test/resources/org/apache/log4j/rewrite/property.log
deleted file mode 100644
index 9aa2c49..0000000
--- a/src/test/resources/org/apache/log4j/rewrite/property.log
+++ /dev/null
@@ -1,2 +0,0 @@
-INFO org.apache.log4j.rewrite.RewriteAppenderTest - p1:Hello p2:World Message 0
-INFO org.apache.log4j.rewrite.RewriteAppenderTest - p1:Hola p2:World Message 1

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/test/resources/org/apache/log4j/rewrite/property.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/org/apache/log4j/rewrite/property.xml 
b/src/test/resources/org/apache/log4j/rewrite/property.xml
deleted file mode 100644
index 13a04f8..0000000
--- a/src/test/resources/org/apache/log4j/rewrite/property.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements.  See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
-    <appender name="F1" class="org.apache.log4j.FileAppender">
-        <param name="file"   value="temp"/>
-        <param name="append" value="false"/>
-        <layout class="org.apache.log4j.PatternLayout">
-           <param name="ConversionPattern" value="%p %c - p1:%X{p1} p2:%X{p2} 
%m%n"/>
-        </layout>
-    </appender>
-
-
-  <appender name="A1" class="org.apache.log4j.rewrite.RewriteAppender">
-      <appender-ref ref="F1"/>
-      <rewritePolicy class="org.apache.log4j.rewrite.PropertyRewritePolicy">
-          <param name="properties" value="p1=Hello,p2=World,x1=3.1415"/>
-      </rewritePolicy>
-  </appender>
-
-  <root>
-    <level value ="debug" />
-    <appender-ref ref="A1" />
-  </root>
-
-</log4j:configuration>

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/test/resources/org/apache/log4j/rewrite/reflection.log
----------------------------------------------------------------------
diff --git a/src/test/resources/org/apache/log4j/rewrite/reflection.log 
b/src/test/resources/org/apache/log4j/rewrite/reflection.log
deleted file mode 100644
index da0b52f..0000000
--- a/src/test/resources/org/apache/log4j/rewrite/reflection.log
+++ /dev/null
@@ -1,3 +0,0 @@
-INFO org.apache.log4j.rewrite.RewriteAppenderTest - p1: p2: Message 0
-INFO org.apache.log4j.rewrite.RewriteAppenderTest - p1: p2:Hello I am bean.
-INFO org.apache.log4j.rewrite.RewriteAppenderTest - p1:Hola p2:Hello Welcome 
to The Hub

http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/deb3b3c0/src/test/resources/org/apache/log4j/rewrite/reflection.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/org/apache/log4j/rewrite/reflection.xml 
b/src/test/resources/org/apache/log4j/rewrite/reflection.xml
deleted file mode 100644
index 643850b..0000000
--- a/src/test/resources/org/apache/log4j/rewrite/reflection.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements.  See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
-    <appender name="F1" class="org.apache.log4j.FileAppender">
-        <param name="file"   value="temp"/>
-        <param name="append" value="false"/>
-        <layout class="org.apache.log4j.PatternLayout">
-           <param name="ConversionPattern" value="%p %c - p1:%X{p1} p2:%X{p2} 
%m%n"/>
-        </layout>
-    </appender>
-
-
-  <appender name="A1" class="org.apache.log4j.rewrite.RewriteAppender">
-      <appender-ref ref="F1"/>
-      <rewritePolicy class="org.apache.log4j.rewrite.ReflectionRewritePolicy"/>
-  </appender>
-
-  <root>
-    <level value ="debug" />
-    <appender-ref ref="A1" />
-  </root>
-
-</log4j:configuration>

Reply via email to