You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2013/08/26 21:53:37 UTC

svn commit: r1517659 - in /logging/log4j/log4j2/trunk: log4j-1.2-api/ log4j-1.2-api/src/main/java/org/apache/log4j/ log4j-1.2-api/src/test/java/org/apache/log4j/ log4j-1.2-api/src/test/resources/ src/changes/

Author: rgoers
Date: Mon Aug 26 19:53:37 2013
New Revision: 1517659

URL: http://svn.apache.org/r1517659
Log:
LOG4J2-368 - Add PatternLayout constructor to Log4j 1.2 bridge for Velocity

Added:
    logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/VelocityTest.java
    logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/resources/hello.vm
Modified:
    logging/log4j/log4j2/trunk/log4j-1.2-api/pom.xml
    logging/log4j/log4j2/trunk/log4j-1.2-api/src/main/java/org/apache/log4j/PatternLayout.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/log4j-1.2-api/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-1.2-api/pom.xml?rev=1517659&r1=1517658&r2=1517659&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-1.2-api/pom.xml (original)
+++ logging/log4j/log4j2/trunk/log4j-1.2-api/pom.xml Mon Aug 26 19:53:37 2013
@@ -52,6 +52,12 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.velocity</groupId>
+      <artifactId>velocity</artifactId>
+      <version>1.7</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>

Modified: logging/log4j/log4j2/trunk/log4j-1.2-api/src/main/java/org/apache/log4j/PatternLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-1.2-api/src/main/java/org/apache/log4j/PatternLayout.java?rev=1517659&r1=1517658&r2=1517659&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-1.2-api/src/main/java/org/apache/log4j/PatternLayout.java (original)
+++ logging/log4j/log4j2/trunk/log4j-1.2-api/src/main/java/org/apache/log4j/PatternLayout.java Mon Aug 26 19:53:37 2013
@@ -23,6 +23,10 @@ import org.apache.log4j.spi.LoggingEvent
  */
 public class PatternLayout extends Layout {
 
+    public PatternLayout(String pattern) {
+
+    }
+
     @Override
     public String format(final LoggingEvent event) {
         return "";

Added: logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/VelocityTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/VelocityTest.java?rev=1517659&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/VelocityTest.java (added)
+++ logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/VelocityTest.java Mon Aug 26 19:53:37 2013
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+import org.junit.Test;
+
+import java.io.StringWriter;
+
+/**
+ *
+ */
+public class VelocityTest {
+
+    @Test
+    public void testVelocity() {
+        Velocity.init();
+        VelocityContext context = new VelocityContext();
+        context.put( "name", new String("Velocity") );
+
+        Template template = Velocity.getTemplate("target/test-classes/hello.vm");
+
+        StringWriter sw = new StringWriter();
+
+        template.merge(context, sw);
+    }
+}

Added: logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/resources/hello.vm
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/resources/hello.vm?rev=1517659&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/resources/hello.vm (added)
+++ logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/resources/hello.vm Mon Aug 26 19:53:37 2013
@@ -0,0 +1,6 @@
+<html>
+<body>
+    #set( $foo = "Velocity" )
+Hello $foo World!
+</body>
+<html>
\ No newline at end of file

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1517659&r1=1517658&r2=1517659&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Mon Aug 26 19:53:37 2013
@@ -21,6 +21,9 @@
   </properties>
   <body>
     <release version="2.0-beta9" date="soon, very soon" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-368" dev="rgoers" type="fix">
+        Add PatternLayout constructor to Log4j 1.2 bridge for Velocity.
+      </action>
       <action issue="LOG4J2-333" dev="ggregory" type="fix" due-to="Hervé Boutemy">
         Match artifact ids with Maven module names.
       </action>