You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2013/07/18 03:31:33 UTC

svn commit: r1504338 - in /logging/log4j/log4j2/trunk: core/src/main/java/org/apache/logging/log4j/core/layout/ core/src/main/resources/ core/src/test/java/org/apache/logging/log4j/core/appender/ src/site/xdoc/manual/

Author: ggregory
Date: Thu Jul 18 01:31:33 2013
New Revision: 1504338

URL: http://svn.apache.org/r1504338
Log:
[LOG4J2-312] XML layout improvements (compact vs. pretty, namespace, namespace prefix, root element). Namespace is now "http://logging.apache.org/log4j/2.0/events" instead of "http://logging.apache.org/log4j/2.0" to allow for "http://logging.apache.org/log4j/2.0/conf" and possibly others. Right now, the config XML has NO namespace.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java
    logging/log4j/log4j2/trunk/core/src/main/resources/Log4j-events.dtd
    logging/log4j/log4j2/trunk/core/src/main/resources/Log4j-events.xsd
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java
    logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml.vm

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java?rev=1504338&r1=1504337&r2=1504338&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java Thu Jul 18 01:31:33 2013
@@ -55,7 +55,7 @@ import org.apache.logging.log4j.message.
  * 
  * <pre>
  * &lt;?xml version="1.0" encoding=&quotUTF-8&quot?&gt;
- * &lt;Events xmlns="http://logging.apache.org/log4j/2.0"&gt;
+ * &lt;Events xmlns="http://logging.apache.org/log4j/2.0/events"&gt;
  * &nbsp;&nbsp;&lt;Event logger="com.foo.Bar" timestamp="1373436580419" level="INFO" thread="main"&gt;
  * &nbsp;&nbsp;&nbsp;&nbsp;&lt;Message>&lt;![CDATA[This is a log message 1]]&gt;&lt;/Message&gt;
  * &nbsp;&nbsp;&lt;/Event&gt;
@@ -85,7 +85,7 @@ import org.apache.logging.log4j.message.
 @Plugin(name = "XMLLayout", category = "Core", elementType = "layout", printObject = true)
 public class XMLLayout extends AbstractStringLayout {
 
-    private static final String XML_NAMESPACE = "http://logging.apache.org/log4j/2.0";
+    private static final String XML_NAMESPACE = "http://logging.apache.org/log4j/2.0/events";
     private static final String ROOT_TAG = "Events";
     private static final int DEFAULT_SIZE = 256;
     

Modified: logging/log4j/log4j2/trunk/core/src/main/resources/Log4j-events.dtd
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/resources/Log4j-events.dtd?rev=1504338&r1=1504337&r2=1504338&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/resources/Log4j-events.dtd (original)
+++ logging/log4j/log4j2/trunk/core/src/main/resources/Log4j-events.dtd Thu Jul 18 01:31:33 2013
@@ -6,7 +6,7 @@
 <!--namespace prefix to namespace uri mappings-->
 <!ENTITY % log4j_prefix.. "%log4j_prefix;:">
 <!--namespaces attributes for root element-->
-<!ENTITY % documentElementAttributes " xmlns:%log4j_prefix; CDATA 'http://logging.apache.org/log4j/2.0'">
+<!ENTITY % documentElementAttributes " xmlns:%log4j_prefix; CDATA 'http://logging.apache.org/log4j/2.0/events'">
 <!--the declarations below should not be modified-->
 <!--element name mappings-->
 <!ENTITY % log4j..Events "%log4j_prefix..;Events">

Modified: logging/log4j/log4j2/trunk/core/src/main/resources/Log4j-events.xsd
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/resources/Log4j-events.xsd?rev=1504338&r1=1504337&r2=1504338&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/resources/Log4j-events.xsd (original)
+++ logging/log4j/log4j2/trunk/core/src/main/resources/Log4j-events.xsd Thu Jul 18 01:31:33 2013
@@ -16,7 +16,7 @@
  See the License for the specific language governing permissions and
  limitations under the License.
 -->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:log4j="http://logging.apache.org/log4j/2.0" targetNamespace="http://logging.apache.org/log4j/2.0" elementFormDefault="qualified" attributeFormDefault="unqualified">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:log4j="http://logging.apache.org/log4j/2.0/events" targetNamespace="http://logging.apache.org/log4j/2.0/events" elementFormDefault="qualified" attributeFormDefault="unqualified">
     <xs:element name="Events">
         <xs:annotation>
             <xs:documentation>Log4J 2.0 XML Schema</xs:documentation>

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderTest.java?rev=1504338&r1=1504337&r2=1504338&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderTest.java Thu Jul 18 01:31:33 2013
@@ -62,7 +62,7 @@ public class XmlCompactFileAppenderTest 
         final String msg1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
         assertTrue("line1 incorrect: [" + line1 + "], does not contain: [" + msg1 + "]", line1.contains(msg1));
 
-        final String msg2 = "<Events xmlns=\"http://logging.apache.org/log4j/2.0\">";
+        final String msg2 = "<Events xmlns=\"http://logging.apache.org/log4j/2.0/events\">";
         assertTrue("line1 incorrect: [" + line1 + "], does not contain: [" + msg2 + "]", line1.contains(msg2));
 
         final String msg3 = "<Event ";

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java?rev=1504338&r1=1504337&r2=1504338&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java Thu Jul 18 01:31:33 2013
@@ -69,7 +69,7 @@ public class XmlCompleteFileAppenderTest
         assertTrue("line1 incorrect: [" + line1 + "], does not contain: [" + msg1 + "]", line1.equals(msg1));
         
         assertNotNull("line2", line2);
-        final String msg2 = "<Events xmlns=\"http://logging.apache.org/log4j/2.0\">";
+        final String msg2 = "<Events xmlns=\"http://logging.apache.org/log4j/2.0/events\">";
         assertTrue("line2 incorrect: [" + line2 + "], does not contain: [" + msg2 + "]", line2.equals(msg2));
         
         assertNotNull("line3", line3);

Modified: logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml.vm
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml.vm?rev=1504338&r1=1504337&r2=1504338&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml.vm (original)
+++ logging/log4j/log4j2/trunk/src/site/xdoc/manual/layouts.xml.vm Thu Jul 18 01:31:33 2013
@@ -1155,7 +1155,7 @@ at org.apache.logging.log4j.core.pattern
           <h4>Complete well-formed XML vs. fragment XML</h4>
           <p>
           If you configure <code>complete="true"</code>, the appender outputs a well-formed XML document where the 
-          default namespace is the Log4j namespace <code>"http://logging.apache.org/log4j/2.0/"</code>.  By default, 
+          default namespace is the Log4j namespace <code>"http://logging.apache.org/log4j/2.0/events"</code>.  By default, 
           with <code>complete="false"</code>, you should include the output as an <em>external entity</em> in a 
           separate file to form a well-formed XML document, in which case the appender uses 
           <code>namespacePrefix</code> with a default of <code>"log4j"</code>.
@@ -1164,7 +1164,7 @@ at org.apache.logging.log4j.core.pattern
           A well-formed XML document follows this pattern:
           </p>
           <pre class="prettyprint linenums">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
-&lt;events xmlns=&quot;http://logging.apache.org/log4j/2.0&quot;&gt;
+&lt;events xmlns=&quot;http://logging.apache.org/log4j/2.0/events&quot;&gt;
   &lt;event logger=&quot;com.foo.Bar&quot; timestamp=&quot;1373436580419&quot; level=&quot;INFO&quot; thread=&quot;main&quot;&gt;
     &lt;message&gt;&lt;![CDATA[This is a log message 1]]&gt;&lt;/message&gt;
   &lt;/event&gt;