logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@apache.org
Subject svn commit: r532515 - in /logging/sandbox/log4j/rolling: ./ src/ src/changes/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/log4j/ src/main/java/org/apache/log4j/rolling/ src/main/java/org/apache/log4j/r...
Date Wed, 25 Apr 2007 22:46:35 GMT
Author: carnold
Date: Wed Apr 25 15:46:30 2007
New Revision: 532515

URL: http://svn.apache.org/viewvc?view=rev&rev=532515
Log:
Bug 42251: Working backport of o.a.l.r.RFA

Added:
    logging/sandbox/log4j/rolling/LICENSE
      - copied unchanged from r532414, logging/sandbox/log4j/component/LICENSE
    logging/sandbox/log4j/rolling/NOTICE
      - copied unchanged from r532414, logging/sandbox/log4j/component/NOTICE
    logging/sandbox/log4j/rolling/build.xml
      - copied, changed from r532414, logging/sandbox/log4j/component/build.xml
    logging/sandbox/log4j/rolling/pom.xml
      - copied, changed from r532414, logging/sandbox/log4j/component/pom.xml
    logging/sandbox/log4j/rolling/src/
    logging/sandbox/log4j/rolling/src/changes/
      - copied from r532414, logging/sandbox/log4j/component/src/changes/
    logging/sandbox/log4j/rolling/src/main/
    logging/sandbox/log4j/rolling/src/main/java/
    logging/sandbox/log4j/rolling/src/main/java/org/
    logging/sandbox/log4j/rolling/src/main/java/org/apache/
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/
      - copied from r532416, logging/log4j/trunk/src/java/org/apache/log4j/rolling/
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/xml/
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/xml/RollingConfigurator.java
      - copied, changed from r532414, logging/sandbox/log4j/component/src/main/java/org/apache/log4j/xml/PluginConfigurator.java
    logging/sandbox/log4j/rolling/src/main/resources/
    logging/sandbox/log4j/rolling/src/main/resources/META-INF/
      - copied from r532414, logging/sandbox/log4j/component/src/main/resources/META-INF/
    logging/sandbox/log4j/rolling/src/site/
      - copied from r532414, logging/sandbox/log4j/component/src/site/
    logging/sandbox/log4j/rolling/src/test/
    logging/sandbox/log4j/rolling/src/test/java/
    logging/sandbox/log4j/rolling/src/test/java/org/
    logging/sandbox/log4j/rolling/src/test/java/org/apache/
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/Compare.java
      - copied, changed from r532429, logging/sandbox/log4j/pattern-layout/src/test/java/org/apache/log4j/util/Compare.java
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/
      - copied from r532416, logging/log4j/trunk/tests/src/java/org/apache/log4j/rolling/
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/util/
    logging/sandbox/log4j/rolling/src/test/resources/
    logging/sandbox/log4j/rolling/src/test/resources/org/
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/filter1.xml
      - copied, changed from r532433, logging/log4j/trunk/tests/input/rolling/filter1.xml
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/helper/
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/renaming.0
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/renaming.0
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/renaming.1
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/renaming.1
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/renaming.2
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/renaming.2
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/sbr-test2.0
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/sbr-test2.0
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/sbr-test2.1
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/sbr-test2.1
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/sbr-test2.log
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/sbr-test2.log
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/sbr-test3.0.gz
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/sbr-test3.0.gz
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/sbr-test3.1.gz
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/sbr-test3.1.gz
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/sbr-test3.log
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/sbr-test3.log
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/sbr-test4.log
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/sbr-test4.log
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test1.0
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/tbr-test1.0
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test1.1
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/tbr-test1.1
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test1.2
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/tbr-test1.2
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test1.3
      - copied unchanged from r532433, logging/log4j/trunk/tests/witness/rolling/tbr-test1.3
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test2.0
      - copied unchanged from r532434, logging/log4j/trunk/tests/witness/rolling/tbr-test2.0
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test2.1
      - copied unchanged from r532434, logging/log4j/trunk/tests/witness/rolling/tbr-test2.1
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test2.2
      - copied unchanged from r532434, logging/log4j/trunk/tests/witness/rolling/tbr-test2.2
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test2.3
      - copied unchanged from r532435, logging/log4j/trunk/tests/witness/rolling/tbr-test2.3
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test3.0.gz
      - copied unchanged from r532435, logging/log4j/trunk/tests/witness/rolling/tbr-test3.0.gz
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test3.1.gz
      - copied unchanged from r532435, logging/log4j/trunk/tests/witness/rolling/tbr-test3.1.gz
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test3.2.gz
      - copied unchanged from r532435, logging/log4j/trunk/tests/witness/rolling/tbr-test3.2.gz
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test3.3
      - copied unchanged from r532435, logging/log4j/trunk/tests/witness/rolling/tbr-test3.3
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test4.0
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test4.0
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test4.1
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test4.1
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test4.2
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test4.2
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test4.3
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test4.3
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test5.0
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test5.0
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test5.1
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test5.1
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test5.2
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test5.2
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test5.3
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test5.3
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test6.0.gz
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test6.0.gz
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test6.1.gz
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test6.1.gz
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test6.2.gz
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test6.2.gz
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/tbr-test6.3
      - copied unchanged from r532436, logging/log4j/trunk/tests/witness/rolling/tbr-test6.3
    logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/time1.xml
      - copied unchanged from r532433, logging/log4j/trunk/tests/input/rolling/time1.xml
Removed:
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/FileOpener.java
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/helper/CompressTestCase.java
Modified:
    logging/sandbox/log4j/rolling/   (props changed)
    logging/sandbox/log4j/rolling/src/changes/changes.xml
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/FilterBasedTriggeringPolicy.java
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/FixedWindowRollingPolicy.java
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/RollingFileAppender.java
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/RollingPolicyBase.java
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/TimeBasedRollingPolicy.java
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/CompositeAction.java
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/GZCompressAction.java
    logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/ZipCompressAction.java
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/FilterBasedRollingTest.java
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/RenamingTest.java
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/SizeBasedRollingTest.java
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/TimeBasedRollingTest.java
    logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/helper/FileNamePatternTestCase.java

Propchange: logging/sandbox/log4j/rolling/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Apr 25 15:46:30 2007
@@ -0,0 +1,5 @@
+target
+output
+apache-log4j-rolling*
+surefire*
+cobertura.ser

Copied: logging/sandbox/log4j/rolling/build.xml (from r532414, logging/sandbox/log4j/component/build.xml)
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/build.xml?view=diff&rev=532515&p1=logging/sandbox/log4j/component/build.xml&r1=532414&p2=logging/sandbox/log4j/rolling/build.xml&r2=532515
==============================================================================
--- logging/sandbox/log4j/component/build.xml (original)
+++ logging/sandbox/log4j/rolling/build.xml Wed Apr 25 15:46:30 2007
@@ -27,8 +27,8 @@
     <property file="build.properties"/>
 	
 	<!--  project details  -->
-    <property name="project.name" value="apache-log4j-component"/>
-    <property name="project.title" value="Component"/>
+    <property name="project.name" value="apache-log4j-rolling"/>
+    <property name="project.title" value="Apache Rolling File Appender Companion for log4j 1.2."/>
     <property name="project.version" value="0.1-SNAPSHOT"/>
     <property name="project.jar" value="${project.name}-${project.version}.jar"/>
     
@@ -38,12 +38,18 @@
 	<!--  Versions for dependencies   -->
     <property name="log4j.version" value="1.2.14"/>
     <property name="junit.version" value="3.8.1"/>
-	
-	<!--  Dependency locations - assumed to be in Maven 2 repository   -->
+    <property name="pattern-layout.version" value="0.1-SNAPSHOT"/>
+    <property name="filters.version" value="0.1-SNAPSHOT"/>
+
+    <!--  Dependency locations - assumed to be in Maven 2 repository   -->
     <property name="junit.jar" 
        location="${m2_repo}/junit/junit/${junit.version}/junit-${junit.version}.jar"/>
     <property name="log4j.jar" 
        location="${m2_repo}/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar"/>
+    <property name="pattern-layout.jar"
+       location="${m2_repo}/log4j/log4j/${pattern-layout.version}/apache-log4j-pattern-layout-${pattern-layout.version}.jar"/>
+    <property name="filters.jar"
+       location="${m2_repo}/log4j/log4j/${filters.version}/apache-log4j-filters-${filters.version}.jar"/>
 
     <!--   Java compiler settings   -->
     <property name="javac.source" value="1.3"/>
@@ -56,6 +62,14 @@
     <target name="clean" depends="init" description="Clean up generated files">
     	<delete dir="target"/>
     </target>
+
+    <path id="compile-classpath" path="${log4j.jar}:${pattern-layout.jar}:${filters.jar}"/>
+	<path id="test-classpath">
+		<path refid="compile-classpath"/>
+		<pathelement location="target/classes"/>
+		<pathelement location="${junit.jar}"/>
+	</path>
+
     
     
     <target name="compile" depends="init" description="Compile implementation files">
@@ -66,7 +80,7 @@
     	   debug="${javac.debug}"
     	   target="${javac.target}"
     	   source="${javac.source}"
-    	   classpath="${log4j.jar}"/>
+    	   classpathref="compile-classpath"/>
     	<copy todir="target/classes">
     	    <fileset dir="src/main/resources"/>
     	</copy>
@@ -97,7 +111,7 @@
     	   debug="${javac.debug}"
     	   target="${javac.target}"
     	   source="${javac.source}"
-    	   classpath="${log4j.jar}:${junit.jar}:target/classes"/>
+    	   classpathref="test-classpath"/>
     	<copy todir="target/test-classes">
     		<fileset dir="src/test/resources"/>
     	</copy>
@@ -106,7 +120,10 @@
 
     <target name="test" depends="test-compile" description="Run unit tests">
     	<junit printsummary="yes">
-    	    <classpath path="target/test-classes:target/classes:${log4j.jar}"/>
+            <classpath>
+                <path refid="test-classpath"/>
+                <pathelement path="target/test-classes"/>
+            </classpath>
     		<batchtest>
     			<fileset dir="src/test/java/">
     				<include name="**/*TestCase.java"/>

Copied: logging/sandbox/log4j/rolling/pom.xml (from r532414, logging/sandbox/log4j/component/pom.xml)
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/pom.xml?view=diff&rev=532515&p1=logging/sandbox/log4j/component/pom.xml&r1=532414&p2=logging/sandbox/log4j/rolling/pom.xml&r2=532515
==============================================================================
--- logging/sandbox/log4j/component/pom.xml (original)
+++ logging/sandbox/log4j/rolling/pom.xml Wed Apr 25 15:46:30 2007
@@ -19,22 +19,20 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>log4j</groupId>
-  <artifactId>apache-log4j-component</artifactId>
+  <artifactId>apache-log4j-rolling</artifactId>
   <packaging>jar</packaging>
   <version>0.1-SNAPSHOT</version>
-  <name>Apache Component Companion for log4j 1.2.</name>
-  <description>This companion emulates the log4j 1.3 Component Framework to
-  simplify the back-porting of code that made use of its services.  It does
-  not provide any immediately useful functionality to log4j by itself,
-  but is used by Receivers and Chainsaw.</description>
-  <url>http://logging.apache.org/log4j/companions/component</url>
+  <name>Apache Rolling File Appender Companion for log4j 1.2.</name>
+  <description>This companion provides the new rolling file appender
+  from the log4j 1.3 project to log4j 1.2 users.</description>
+  <url>http://logging.apache.org/log4j/companions/rollingt</url>
   <issueManagement>
     <system>Bugzilla</system>
     <url>http://issues.apache.org/bugzilla/</url>
   </issueManagement>
   <ciManagement>
   		<system>Gump</system>
-  		 <url>http://vmgump.apache.org/gump/public/logging-log4j-component/logging-log4j-component/index.html</url>
+  		 <url>http://vmgump.apache.org/gump/public/logging-log4j-rolling/logging-log4j-rolling/index.html</url>
   </ciManagement>
 <mailingLists>
 	<mailingList>
@@ -76,9 +74,9 @@
 	</license>
 </licenses>
 <scm>
-	<connection>scm:svn:http://svn.apache.org/repos/asf/logging/sandbox/log4j/component</connection>
-	<developerConnection>scm:svn:https://svn.apache.org/repos/asf/logging/sandbox/log4j/component</developerConnection>
-	<url>http://svn.apache.org/viewcvs.cgi/logging/sandbox/log4j/component</url>
+	<connection>scm:svn:http://svn.apache.org/repos/asf/logging/sandbox/log4j/rolling</connection>
+	<developerConnection>scm:svn:https://svn.apache.org/repos/asf/logging/sandbox/log4j/rolling</developerConnection>
+	<url>http://svn.apache.org/viewcvs.cgi/logging/sandbox/log4j/rolling</url>
 </scm>
 <organization>
     <name>Apache Software Foundation</name>
@@ -130,6 +128,16 @@
       <artifactId>log4j</artifactId>
       <version>1.2.14</version>
     </dependency>    
+      <dependency>
+        <groupId>log4j</groupId>
+        <artifactId>apache-log4j-pattern-layout</artifactId>
+        <version>0.1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>log4j</groupId>
+        <artifactId>apache-log4j-filters</artifactId>
+        <version>0.1-SNAPSHOT</version>
+      </dependency>
   </dependencies>
   <reporting>
     <plugins>
@@ -175,7 +183,7 @@
  <distributionManagement>
     <site>
       <id>apache.website</id>
-      <url>scp://people.apache.org/home/carnold/public_html/log4j/companions/component</url>
+      <url>scp://people.apache.org/home/carnold/public_html/log4j/companions/rolling</url>
     </site>
   </distributionManagement> 
   

Modified: logging/sandbox/log4j/rolling/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/changes/changes.xml?view=diff&rev=532515&r1=532414&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/changes/changes.xml (original)
+++ logging/sandbox/log4j/rolling/src/changes/changes.xml Wed Apr 25 15:46:30 2007
@@ -1 +1,29 @@
-<!--
 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.

-->
<document>
  <properties>
    <title>Component</title>
  </properties>
  <body>
    <release version="0.1" date="2099-01-01" description="First release">
      <action dev="carnold" issue="42094" type="add">
   
      Initial release of Component framework backported from log4j 1.3.
      </action>
    </release>
  </body>
</document>
\ No newline at end of file
+<!--
+ 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.
+
+-->
+<document>
+  <properties>
+    <title>Component</title>
+  </properties>
+  <body>
+    <release version="0.1" date="2099-01-01" description="First release">
+      <action dev="carnold" issue="42094" type="add">
+        Initial release of companion.
+      </action>
+    </release>
+  </body>
+</document>
\ No newline at end of file

Modified: logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/FilterBasedTriggeringPolicy.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/FilterBasedTriggeringPolicy.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/FilterBasedTriggeringPolicy.java (original)
+++ logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/FilterBasedTriggeringPolicy.java Wed Apr 25 15:46:30 2007
@@ -19,6 +19,11 @@
 import org.apache.log4j.Appender;
 import org.apache.log4j.spi.Filter;
 import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.spi.OptionHandler;
+import org.apache.log4j.xml.*;
+import org.w3c.dom.Element;
+
+import java.util.Properties;
 
 
 /**
@@ -30,7 +35,8 @@
  * @since 1.3
  *
  */
-public final class FilterBasedTriggeringPolicy implements TriggeringPolicy {
+public final class FilterBasedTriggeringPolicy
+        implements TriggeringPolicy, UnrecognizedElementParser {
   /**
    * The first filter in the filter chain. Set to <code>null</code> initially.
    */
@@ -118,4 +124,22 @@
       f.activateOptions();
     }
   }
+
+    /**
+     * {@inheritDoc}
+     */
+  public boolean parseUnrecognizedElement(final Element element,
+                                          final Properties props) throws Exception {
+      final String nodeName = element.getNodeName();
+      if ("filter".equals(nodeName)) {
+          OptionHandler filter = RollingConfigurator.parseElement(element, props, Filter.class);
+          if (filter instanceof Filter) {
+              filter.activateOptions();
+              this.addFilter((Filter) filter);
+          }
+          return true;
+      }
+      return false;
+  }
+
 }

Modified: logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/FixedWindowRollingPolicy.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/FixedWindowRollingPolicy.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/FixedWindowRollingPolicy.java (original)
+++ logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/FixedWindowRollingPolicy.java Wed Apr 25 15:46:30 2007
@@ -25,6 +25,7 @@
 import org.apache.log4j.rolling.helper.FileRenameAction;
 import org.apache.log4j.rolling.helper.GZCompressAction;
 import org.apache.log4j.rolling.helper.ZipCompressAction;
+import org.apache.log4j.helpers.LogLog;
 
 
 /**
@@ -99,17 +100,17 @@
     super.activateOptions();
 
     if (maxIndex < minIndex) {
-      getLogger().warn(
+      LogLog.warn(
         "MaxIndex (" + maxIndex + ") cannot be smaller than MinIndex ("
         + minIndex + ").");
-      getLogger().warn("Setting maxIndex to equal minIndex.");
+      LogLog.warn("Setting maxIndex to equal minIndex.");
       maxIndex = minIndex;
     }
 
     if ((maxIndex - minIndex) > MAX_WINDOW_SIZE) {
-      getLogger().warn("Large window sizes are not allowed.");
+      LogLog.warn("Large window sizes are not allowed.");
       maxIndex = minIndex + MAX_WINDOW_SIZE;
-      getLogger().warn("MaxIndex reduced to {}.", new Integer(maxIndex));
+      LogLog.warn("MaxIndex reduced to " + String.valueOf(maxIndex) + ".");
     }
 
     PatternConverter itc = getIntegerPatternConverter();
@@ -174,12 +175,12 @@
         renameTo = renameTo.substring(0, renameTo.length() - 3);
         compressAction =
           new GZCompressAction(
-            new File(renameTo), new File(compressedName), true, getLogger());
+            new File(renameTo), new File(compressedName), true);
       } else if (renameTo.endsWith(".zip")) {
         renameTo = renameTo.substring(0, renameTo.length() - 4);
         compressAction =
           new ZipCompressAction(
-            new File(renameTo), new File(compressedName), true, getLogger());
+            new File(renameTo), new File(compressedName), true);
       }
 
       FileRenameAction renameAction =
@@ -311,7 +312,7 @@
           return false;
         }
       } catch (Exception ex) {
-        getLogger().info("Exception during purge in RollingFileAppender", ex);
+        LogLog.warn("Exception during purge in RollingFileAppender", ex);
 
         return false;
       }

Modified: logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/RollingFileAppender.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/RollingFileAppender.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/RollingFileAppender.java (original)
+++ logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/RollingFileAppender.java Wed Apr 25 15:46:30 2007
@@ -16,9 +16,22 @@
 
 package org.apache.log4j.rolling;
 
+import org.apache.log4j.Appender;
 import org.apache.log4j.FileAppender;
+import org.apache.log4j.Logger;
+import org.apache.log4j.config.PropertySetter;
+import org.apache.log4j.helpers.LogLog;
+import org.apache.log4j.helpers.OptionConverter;
+import org.apache.log4j.helpers.QuietWriter;
 import org.apache.log4j.rolling.helper.Action;
+import org.apache.log4j.spi.ErrorHandler;
 import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.spi.OptionHandler;
+import org.apache.log4j.xml.UnrecognizedElementParser;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.apache.log4j.xml.RollingConfigurator;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -26,6 +39,7 @@
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.util.Properties;
 
 
 /**
@@ -40,7 +54,8 @@
  * <code>RollingPolicy</code> and a <code>TriggeringPolicy</code>.
  *
  * <p><code>RollingFileAppender</code> can be configured programattically or
- * using {@link org.apache.log4j.joran.JoranConfigurator}. Here is a sample
+ * using {@link org.apache.log4j.xml.RollingConfigurator} or
+ * {@link org.apache.log4j.DOMConfigurator} in log4j 1.2.15 or later. Here is a sample
  * configration file:
 
 <pre>&lt;?xml version="1.0" encoding="UTF-8" ?>
@@ -73,7 +88,8 @@
  * @author Ceki G&uuml;lc&uuml;
  * @since  1.3
  * */
-public final class RollingFileAppender extends FileAppender {
+public final class RollingFileAppender extends FileAppender
+        implements UnrecognizedElementParser {
   /**
    * Triggering policy.
    */
@@ -94,6 +110,7 @@
    */
   private Action lastRolloverAsyncAction = null;
 
+
   /**
    * Construct a new instance.
    */
@@ -105,9 +122,9 @@
    */
   public void activateOptions() {
     if (rollingPolicy == null) {
-      getLogger().warn(
-        "Please set a rolling policy for the RollingFileAppender named '{}'",
-        getName());
+      LogLog.warn(
+        "Please set a rolling policy for the RollingFileAppender named '"
+                + getName() + "'");
 
         return;
     }
@@ -121,9 +138,9 @@
     }
 
     if (triggeringPolicy == null) {
-      getLogger().warn(
-        "Please set a TriggeringPolicy for the RollingFileAppender named '{}'",
-        getName());
+      LogLog.warn(
+        "Please set a TriggeringPolicy for the RollingFileAppender named '"
+                + getName() + "'");
 
       return;
     }
@@ -170,12 +187,22 @@
     }
 
     if (exception != null) {
-      getLogger().warn(
+      LogLog.warn(
         "Exception while initializing RollingFileAppender named '" + getName()
         + "'", exception);
     }
   }
 
+
+    private final QuietWriter createQuietWriter(final Writer writer) {
+         ErrorHandler handler = errorHandler;
+         if (handler == null) {
+             handler = new DefaultErrorHandler(this);
+         }
+         return new QuietWriter(writer, handler);
+     }
+
+
   /**
      Implements the usual roll over behaviour.
 
@@ -253,9 +280,9 @@
                   rollover.getActiveFileName(), true, bufferedIO, bufferSize);
 
                 if (exception == null) {
-                  getLogger().warn("Failure in post-close rollover action");
+                  LogLog.warn("Failure in post-close rollover action");
                 } else {
-                  getLogger().warn(
+                  LogLog.warn(
                     "Exception in post-close rollover action", exception);
                 }
               }
@@ -304,7 +331,7 @@
       }
 
       if (exception != null) {
-        getLogger().warn(
+        LogLog.warn(
           "Exception during rollover, rollover deferred.", exception);
       }
     }
@@ -329,7 +356,7 @@
       try {
         rollover();
       } catch (Exception ex) {
-          getLogger().info("Exception during rollover attempt.", ex);
+          LogLog.warn("Exception during rollover attempt.", ex);
       }
     }
 
@@ -410,6 +437,33 @@
     fileLength += increment;
   }
 
+
+
+    /**
+     * {@inheritDoc}
+     */
+  public boolean parseUnrecognizedElement(final Element element,
+                                          final Properties props) throws Exception {
+      final String nodeName = element.getNodeName();
+      if ("rollingPolicy".equals(nodeName)) {
+          OptionHandler rollingPolicy = RollingConfigurator.parseElement(element, props, RollingPolicy.class);
+          if (rollingPolicy != null) {
+              rollingPolicy.activateOptions();
+              this.setRollingPolicy((RollingPolicy) rollingPolicy);
+          }
+          return true;
+      }
+      if ("triggeringPolicy".equals(nodeName)) {
+          OptionHandler triggerPolicy = RollingConfigurator.parseElement(element, props, TriggeringPolicy.class);
+          if (triggerPolicy != null) {
+              triggerPolicy.activateOptions();
+              this.setTriggeringPolicy((TriggeringPolicy) triggerPolicy);
+          }
+          return true;
+      }
+      return false;
+  }
+
   /**
    * Wrapper for OutputStream that will report all write
    * operations back to this class for file length calculations.
@@ -475,4 +529,39 @@
       rfa.incrementFileLength(1);
     }
   }
+
+    private static final class DefaultErrorHandler implements ErrorHandler {
+        private final RollingFileAppender appender;
+        public DefaultErrorHandler(final RollingFileAppender appender) {
+            this.appender = appender;
+        }
+        /**@since 1.2*/
+        public void setLogger(Logger logger) {
+
+        }
+        public void error(String message, Exception ioe, int errorCode) {
+          appender.close();
+          LogLog.error("IO failure for appender named "+ appender.getName(), ioe);
+        }
+        public void error(String message) {
+
+        }
+        /**@since 1.2*/
+        public void error(String message, Exception e, int errorCode, LoggingEvent event) {
+
+        }
+        /**@since 1.2*/
+        public void setAppender(Appender appender) {
+
+        }
+        /**@since 1.2*/
+        public void setBackupAppender(Appender appender) {
+
+        }
+
+        public void activateOptions() {
+        }
+
+    }
+
 }

Modified: logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/RollingPolicyBase.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/RollingPolicyBase.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/RollingPolicyBase.java (original)
+++ logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/RollingPolicyBase.java Wed Apr 25 15:46:30 2007
@@ -21,7 +21,7 @@
 import org.apache.log4j.pattern.PatternParser;
 import org.apache.log4j.pattern.IntegerPatternConverter;
 import org.apache.log4j.pattern.DatePatternConverter;
-import org.apache.log4j.spi.ComponentBase;
+import org.apache.log4j.helpers.LogLog;
 import org.apache.log4j.spi.OptionHandler;
 
 import java.util.ArrayList;
@@ -37,7 +37,7 @@
  * @author Curt Arnold
  * @since 1.3
  */
-public abstract class RollingPolicyBase extends ComponentBase
+public abstract class RollingPolicyBase
   implements RollingPolicy, OptionHandler {
     /**
      * Error message.
@@ -80,8 +80,8 @@
       if (fileNamePatternStr != null) {
         parseFileNamePattern();
       } else {
-        getLogger().warn(FNP_NOT_SET);
-        getLogger().warn(SEE_FNP_NOT_SET);
+        LogLog.warn(FNP_NOT_SET);
+        LogLog.warn(SEE_FNP_NOT_SET);
         throw new IllegalStateException(FNP_NOT_SET + SEE_FNP_NOT_SET);
       }
 
@@ -130,7 +130,7 @@
 
     PatternParser.parse(
       fileNamePatternStr, converters, fields, null,
-      PatternParser.getFileNamePatternRules(), getLogger());
+      PatternParser.getFileNamePatternRules());
     patternConverters = new PatternConverter[converters.size()];
     patternConverters =
       (PatternConverter[]) converters.toArray(patternConverters);

Modified: logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/TimeBasedRollingPolicy.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/TimeBasedRollingPolicy.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/TimeBasedRollingPolicy.java (original)
+++ logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/TimeBasedRollingPolicy.java Wed Apr 25 15:46:30 2007
@@ -256,13 +256,13 @@
     if (suffixLength == 3) {
       compressAction =
         new GZCompressAction(
-          new File(lastBaseName), new File(lastFileName), true, getLogger());
+          new File(lastBaseName), new File(lastFileName), true);
     }
 
     if (suffixLength == 4) {
       compressAction =
         new ZipCompressAction(
-          new File(lastBaseName), new File(lastFileName), true, getLogger());
+          new File(lastBaseName), new File(lastFileName), true);
     }
 
     lastFileName = newFileName;

Modified: logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/CompositeAction.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/CompositeAction.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/CompositeAction.java (original)
+++ logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/CompositeAction.java Wed Apr 25 15:46:30 2007
@@ -19,7 +19,7 @@
 import java.io.IOException;
 
 import java.util.List;
-import org.apache.log4j.ULogger;
+import org.apache.log4j.helpers.LogLog;
 
 
 /**
@@ -39,24 +39,17 @@
    * Stop on error.
    */
   private final boolean stopOnError;
-    /**
-     * Logger.
-     */
-  private final ULogger logger;
 
   /**
    * Construct a new composite action.
    * @param actions list of actions, may not be null.
    * @param stopOnError if true, stop on the first false return value or exception.
-   * @param logger logger, may be null.
    */
   public CompositeAction(final List actions, 
-                         final boolean stopOnError, 
-                         final ULogger logger) {
+                         final boolean stopOnError) {
     this.actions = new Action[actions.size()];
     actions.toArray(this.actions);
     this.stopOnError = stopOnError;
-    this.logger = logger;
   }
 
   /**
@@ -66,9 +59,7 @@
     try {
       execute();
     } catch (IOException ex) {
-        if (logger != null) {
-            logger.info("Exception during file rollover.", ex);
-        }
+         LogLog.warn("Exception during file rollover.", ex);
     }
   }
 

Modified: logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/GZCompressAction.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/GZCompressAction.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/GZCompressAction.java (original)
+++ logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/GZCompressAction.java Wed Apr 25 15:46:30 2007
@@ -16,7 +16,7 @@
 
 package org.apache.log4j.rolling.helper;
 
-import org.apache.log4j.ULogger;
+import org.apache.log4j.helpers.LogLog;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -48,10 +48,6 @@
    */
   private final boolean deleteSource;
 
-  /**
-   * Logger to receive diagnostic messages.
-   */
-  private final ULogger logger;
 
   /**
    * Create new instance of GZCompressAction.
@@ -60,11 +56,9 @@
    * @param destination compressed file, may not be null.
    * @param deleteSource if true, attempt to delete file on completion.  Failure to delete
    * does not cause an exception to be thrown or affect return value.
-   * @param logger logger, may be null.
    */
   public GZCompressAction(
-    final File source, final File destination, final boolean deleteSource,
-    final ULogger logger) {
+    final File source, final File destination, final boolean deleteSource) {
     if (source == null) {
       throw new NullPointerException("source");
     }
@@ -76,7 +70,6 @@
     this.source = source;
     this.destination = destination;
     this.deleteSource = deleteSource;
-    this.logger = logger;
   }
 
   /**
@@ -85,7 +78,7 @@
    * @throws IOException on IO exception.
    */
   public boolean execute() throws IOException {
-    return execute(source, destination, deleteSource, logger);
+    return execute(source, destination, deleteSource);
   }
 
   /**
@@ -95,13 +88,12 @@
    * @param destination compressed file, may not be null.
    * @param deleteSource if true, attempt to delete file on completion.  Failure to delete
    * does not cause an exception to be thrown or affect return value.
-   * @param logger logger, may be null.
    * @return true if source file compressed.
    * @throws IOException on IO exception.
    */
   public static boolean execute(
-    final File source, final File destination, final boolean deleteSource,
-    final ULogger logger) throws IOException {
+    final File source, final File destination, final boolean deleteSource)
+          throws IOException {
     if (source.exists()) {
       FileInputStream fis = new FileInputStream(source);
       FileOutputStream fos = new FileOutputStream(destination);
@@ -117,8 +109,8 @@
       fis.close();
 
       if (deleteSource) {
-        if (!source.delete() && (logger != null)) {
-          logger.info("Unable to delete {}.", source.toString());
+        if (!source.delete()) {
+          LogLog.warn("Unable to delete " + source.toString() + ".");
         }
       }
 
@@ -135,9 +127,7 @@
      * @param ex exception.
      */
     protected void reportException(final Exception ex) {
-        if (logger != null) {
-            logger.info("Exception during compression of '" + source.toString() + "'.", ex);
-        }
+         LogLog.warn("Exception during compression of '" + source.toString() + "'.", ex);
     }
 
 }

Modified: logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/ZipCompressAction.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/ZipCompressAction.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/ZipCompressAction.java (original)
+++ logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/rolling/helper/ZipCompressAction.java Wed Apr 25 15:46:30 2007
@@ -16,7 +16,7 @@
 
 package org.apache.log4j.rolling.helper;
 
-import org.apache.log4j.ULogger;
+import org.apache.log4j.helpers.LogLog;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -49,10 +49,6 @@
    */
   private final boolean deleteSource;
 
-  /**
-   * Logger to receive diagnostic messages.
-   */
-  private final ULogger logger;
 
   /**
    * Create new instance of GZCompressAction.
@@ -61,11 +57,9 @@
    * @param destination compressed file, may not be null.
    * @param deleteSource if true, attempt to delete file on completion.  Failure to delete
    * does not cause an exception to be thrown or affect return value.
-   * @param logger logger, may be null.
    */
   public ZipCompressAction(
-    final File source, final File destination, final boolean deleteSource,
-    final ULogger logger) {
+    final File source, final File destination, final boolean deleteSource) {
     if (source == null) {
       throw new NullPointerException("source");
     }
@@ -77,7 +71,6 @@
     this.source = source;
     this.destination = destination;
     this.deleteSource = deleteSource;
-    this.logger = logger;
   }
 
   /**
@@ -86,7 +79,7 @@
    * @throws IOException on IO exception.
    */
   public boolean execute() throws IOException {
-    return execute(source, destination, deleteSource, logger);
+    return execute(source, destination, deleteSource);
   }
 
   /**
@@ -96,13 +89,12 @@
    * @param destination compressed file, may not be null.
    * @param deleteSource if true, attempt to delete file on completion.  Failure to delete
    * does not cause an exception to be thrown or affect return value.
-   * @param logger logger, may be null.
    * @return true if source file compressed.
    * @throws IOException on IO exception.
    */
   public static boolean execute(
-    final File source, final File destination, final boolean deleteSource,
-    final ULogger logger) throws IOException {
+    final File source, final File destination, final boolean deleteSource)
+          throws IOException {
     if (source.exists()) {
       FileInputStream fis = new FileInputStream(source);
       FileOutputStream fos = new FileOutputStream(destination);
@@ -122,8 +114,8 @@
       fis.close();
 
       if (deleteSource) {
-        if (!source.delete() && (logger != null)) {
-          logger.info("Unable to delete {}.", source.toString());
+        if (!source.delete() ) {
+          LogLog.warn("Unable to delete " + source.toString() + ".");
         }
       }
 
@@ -139,8 +131,6 @@
      * @param ex exception.
      */
     protected void reportException(final Exception ex) {
-        if (logger != null) {
-            logger.info("Exception during compression of '" + source.toString() + "'.", ex);
-        }
+            LogLog.warn("Exception during compression of '" + source.toString() + "'.", ex);
     }
 }

Copied: logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/xml/RollingConfigurator.java (from r532414, logging/sandbox/log4j/component/src/main/java/org/apache/log4j/xml/PluginConfigurator.java)
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/xml/RollingConfigurator.java?view=diff&rev=532515&p1=logging/sandbox/log4j/component/src/main/java/org/apache/log4j/xml/PluginConfigurator.java&r1=532414&p2=logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/xml/RollingConfigurator.java&r2=532515
==============================================================================
--- logging/sandbox/log4j/component/src/main/java/org/apache/log4j/xml/PluginConfigurator.java (original)
+++ logging/sandbox/log4j/rolling/src/main/java/org/apache/log4j/xml/RollingConfigurator.java Wed Apr 25 15:46:30 2007
@@ -17,34 +17,36 @@
 
 package org.apache.log4j.xml;
 
+import org.apache.log4j.Appender;
 import org.apache.log4j.LogManager;
 import org.apache.log4j.config.PropertySetter;
 import org.apache.log4j.helpers.FileWatchdog;
+import org.apache.log4j.helpers.Loader;
 import org.apache.log4j.helpers.LogLog;
 import org.apache.log4j.helpers.OptionConverter;
-import org.apache.log4j.plugins.Plugin;
+import org.apache.log4j.spi.AppenderAttachable;
 import org.apache.log4j.spi.LoggerRepository;
-import org.apache.log4j.spi.LoggerRepositoryEx;
+import org.apache.log4j.spi.OptionHandler;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import java.io.*;
 
 import javax.xml.parsers.FactoryConfigurationError;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.Properties;
 
 /**
  * This class extends DOMConfigurator to support
  * processing of plugin elements.
  */
-public class PluginConfigurator extends
+public class RollingConfigurator extends
         org.apache.log4j.xml.DOMConfigurator {
 
     /**
      * Create new instance.
      */
-    public PluginConfigurator() {
+    public RollingConfigurator() {
         super();
     }
 
@@ -56,7 +58,7 @@
     static
     public
     void configure (final Element element) {
-      PluginConfigurator configurator = new PluginConfigurator();
+      RollingConfigurator configurator = new RollingConfigurator();
       configurator.doConfigure(element,  LogManager.getLoggerRepository());
     }
 
@@ -65,7 +67,7 @@
     static
     public
     void configure(final String filename) throws FactoryConfigurationError {
-      new PluginConfigurator().doConfigure(filename, 
+      new RollingConfigurator().doConfigure(filename,
                         LogManager.getLoggerRepository());
     }
 
@@ -75,7 +77,7 @@
     static
     public
     void configure(final URL url) throws FactoryConfigurationError {
-      new PluginConfigurator().doConfigure(url, LogManager.getLoggerRepository());
+      new RollingConfigurator().doConfigure(url, LogManager.getLoggerRepository());
     }
 
     /**
@@ -115,121 +117,165 @@
 
 
     /**
-     * {@inheritDoc}
+     * Walks the children of the node to determine if
+     * any children are rollingPolicy or triggeringPolicy
+     * elements.  Does not recurse into entity references
+     * since DOMConfigurator doesn't handle them.
+     * @param node
+     * @return
      */
-    protected void parse(final Element element) {
-        super.parse(element);
-        if (repository instanceof LoggerRepositoryEx) {
-            List plugins = new ArrayList();
-            createPlugins((LoggerRepositoryEx) repository, plugins, element);
-            for (Iterator iter = plugins.iterator(); iter.hasNext();) {
-                ((Plugin) iter.next()).activateOptions();
-            }
-        }
-    }
-
-    /**
-     * Iterates over child nodes looking for plugin elements
-     * and constructs the plugins.
-     * @param repox repository
-     * @param plugins list to receive created plugins
-     * @param node parent node
-     */
-    private void createPlugins(
-            final LoggerRepositoryEx repox,
-            final List plugins, final Node node) {
+    private final static boolean hasPolicy(final Node node) {
         Node child = node.getFirstChild();
-        while (child != null) {
-            switch (child.getNodeType()) {
-                case Node.ELEMENT_NODE:
-                    if ("plugin".equals(child.getNodeName())) {
-                        createPlugin(repox, plugins, (Element) child);
-                    }
-                    break;
-
-                case Node.ENTITY_REFERENCE_NODE:
-                    createPlugins(repox, plugins, child);
-                    break;
-
-                default:
+        while(child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                if ("rollingPolicy".equals(child.getNodeName()) ||
+                    "triggeringPolicy".equals(child.getNodeName())) {
+                    return true;
+                }
             }
             child = child.getNextSibling();
         }
+        return false;
     }
 
     /**
-     * Iterates over children of plugin node looking for
-     * param elements.
-     * @param propSetter property setter
-     * @param parent parent node
+       Used internally to parse an appender element.
      */
-    private void setParams(final PropertySetter propSetter,
-                           final Node parent) {
-        Node child = parent.getFirstChild();
-        while (child != null) {
-            switch (child.getNodeType()) {
-                case Node.ELEMENT_NODE:
-                    if ("param".equals(child.getNodeName())) {
-                        setParameter((Element) child, propSetter);
-                    }
-                    break;
-
-                case Node.ENTITY_REFERENCE_NODE:
-                    setParams(propSetter, child);
-                    break;
+    protected Appender parseAppender (final Element appenderElement) {
+        //
+        //   if there were no policy elements,
+        //      delegate to the underlying implementation
+        //
+        if (!hasPolicy(appenderElement)) {
+            return super.parseAppender(appenderElement);
+        }
 
-                default:
+        //
+        //  Cut and paste of the body of the log4j 1.2.15
+        //      implementation.  There was no place to hook
+        //      to process the policies before the appender was
+        //      activated.
+
+        String className = subst(appenderElement.getAttribute(CLASS_ATTR));
+        LogLog.debug("Class name: [" + className+']');
+        try {
+          Object instance 	= Loader.loadClass(className).newInstance();
+          Appender appender	= (Appender)instance;
+          PropertySetter propSetter = new PropertySetter(appender);
+
+          appender.setName(subst(appenderElement.getAttribute(NAME_ATTR)));
+
+          NodeList children	= appenderElement.getChildNodes();
+          final int length 	= children.getLength();
+
+          for (int loop = 0; loop < length; loop++) {
+        Node currentNode = children.item(loop);
+
+        /* We're only interested in Elements */
+        if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
+          Element currentElement = (Element)currentNode;
+
+          // Parse appender parameters
+          if (currentElement.getTagName().equals(PARAM_TAG)) {
+                setParameter(currentElement, propSetter);
+          }
+          // Set appender layout
+          else if (currentElement.getTagName().equals(LAYOUT_TAG)) {
+            appender.setLayout(parseLayout(currentElement));
+          }
+          // Add filters
+          else if (currentElement.getTagName().equals(FILTER_TAG)) {
+            parseFilters(currentElement, appender);
+          }
+          else if (currentElement.getTagName().equals(ERROR_HANDLER_TAG)) {
+            parseErrorHandler(currentElement, appender);
+          }
+          else if (currentElement.getTagName().equals(APPENDER_REF_TAG)) {
+            String refName = subst(currentElement.getAttribute(REF_ATTR));
+            if(appender instanceof AppenderAttachable) {
+              AppenderAttachable aa = (AppenderAttachable) appender;
+              LogLog.debug("Attaching appender named ["+ refName+
+                   "] to appender named ["+ appender.getName()+"].");
+              aa.addAppender(findAppenderByReference(currentElement));
+            } else {
+              LogLog.error("Requesting attachment of appender named ["+
+                   refName+ "] to appender named ["+ appender.getName()+
+                    "] which does not implement org.apache.log4j.spi.AppenderAttachable.");
             }
-            child = child.getNextSibling();
+          } else {
+              if (instance instanceof UnrecognizedElementParser) {
+                  ((UnrecognizedElementParser) instance).
+                          parseUnrecognizedElement(currentElement, props);
+              }
+          }
         }
+          }
 
-
+          propSetter.activate();
+          return appender;
+        }
+        /* Yes, it's ugly.  But all of these exceptions point to the same
+           problem: we can't create an Appender */
+        catch (Exception oops) {
+          LogLog.error("Could not create an Appender. Reported error follows.",
+               oops);
+          return null;
+        }
     }
 
-    /**
-     * Creates a plugin
-     * @param repox repository
-     * @param plugins list of receive created plugins
-     * @param element plugin element
-     */
-    private void createPlugin(
-            final LoggerRepositoryEx repox,
-            final List plugins,
-            final Element element) {
-        String className = element.getAttribute("class");
-
-        if (className.length() > 0)
+        public static
+          String subst(final String value, final Properties props) {
             try {
-                LogLog.debug(
-                        "About to instantiate plugin of type [" + className + "]");
-
-                Plugin plugin = (Plugin)
-                        OptionConverter.instantiateByClassName(
-                                className, org.apache.log4j.plugins.Plugin.class, null);
-
-                String pluginName = subst(element.getAttribute("name"));
-
-                if (pluginName.length() == 0) {
-                    LogLog.warn(
-                            "No plugin name given for plugin of type " + className + "].");
-                } else {
-                    plugin.setName(pluginName);
-                    LogLog.debug("plugin named as [" + pluginName + "]");
-                }
-
-                PropertySetter propSetter = new PropertySetter(plugin);
-                setParams(propSetter, element);
+              return OptionConverter.substVars(value, props);
+            } catch(IllegalArgumentException e) {
+              LogLog.warn("Could not perform variable substitution.", e);
+              return value;
+            }
+          }
 
-                repox.getPluginRegistry().addPlugin(plugin);
-                plugin.setLoggerRepository(repox);
 
-                LogLog.debug("Pushing plugin on to the object stack.");
-                plugins.add(plugin);
-            } catch (Exception oops) {
-                LogLog.error(
-                        "Could not create a plugin. Reported error follows.", oops);
+        public static
+          void setParameter(Element elem, PropertySetter propSetter,
+                  Properties
+              props) {
+            String name = subst(elem.getAttribute("name"), props);
+            String value = (elem.getAttribute("value"));
+            value = subst(OptionConverter.convertSpecialChars(value), props);
+            propSetter.setProperty(name, value);
+          }
+
+        public static OptionHandler parseElement(final Element element,
+                                          final Properties props,
+                                          final Class expectedClass) throws Exception {
+            String clazz = subst(element.getAttribute("class"), props);
+            Object instance = OptionConverter.instantiateByClassName(clazz,
+                                                        expectedClass, null);
+
+            if(instance instanceof OptionHandler) {
+                OptionHandler policy = (OptionHandler) instance;
+              PropertySetter propSetter = new PropertySetter(policy);
+              NodeList children = element.getChildNodes();
+              final int length 	= children.getLength();
+
+              for (int loop = 0; loop < length; loop++) {
+            Node currentNode = children.item(loop);
+            if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
+              Element currentElement = (Element) currentNode;
+              String tagName = currentElement.getTagName();
+              if(tagName.equals("param")) {
+                    setParameter(currentElement, propSetter, props);
+              } else {
+                  if (instance instanceof UnrecognizedElementParser) {
+                      ((UnrecognizedElementParser) instance).parseUnrecognizedElement(currentElement, props);
+                  }
+              }
             }
-    }
+              }
+                return policy;
+            }
+            return null;
+          }
+
 
     /**
      * File change monitor class.
@@ -249,7 +295,7 @@
          <code>filename</code> to reconfigure log4j. */
       public
       void doOnChange() {
-        new PluginConfigurator().doConfigure(filename,
+        new RollingConfigurator().doConfigure(filename,
                           LogManager.getLoggerRepository());
       }
     }

Copied: logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/Compare.java (from r532429, logging/sandbox/log4j/pattern-layout/src/test/java/org/apache/log4j/util/Compare.java)
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/Compare.java?view=diff&rev=532515&p1=logging/sandbox/log4j/pattern-layout/src/test/java/org/apache/log4j/util/Compare.java&r1=532429&p2=logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/Compare.java&r2=532515
==============================================================================
--- logging/sandbox/log4j/pattern-layout/src/test/java/org/apache/log4j/util/Compare.java (original)
+++ logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/Compare.java Wed Apr 25 15:46:30 2007
@@ -18,12 +18,14 @@
 package org.apache.log4j.util;
 
 import java.io.BufferedReader;
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.io.*;
+import java.util.zip.GZIPInputStream;
 
 
 public class Compare {
@@ -135,4 +137,66 @@
     }
     in1.close();
   }
+
+
+    public static boolean gzCompare(final Class testClass,
+                                    final String actual,
+                                    final String expected)
+      throws FileNotFoundException, IOException {
+      String resourceName = expected;
+      int lastSlash = expected.lastIndexOf("/");
+      if (lastSlash >= 0) {
+          resourceName = expected.substring(lastSlash + 1);
+      }
+      InputStream resourceStream = testClass.getResourceAsStream(resourceName);
+      if (resourceStream == null) {
+          throw new FileNotFoundException("Could not locate resource " + resourceName);
+      }
+
+      BufferedReader in1 = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(actual))));
+      BufferedReader in2 = new BufferedReader(new InputStreamReader(new GZIPInputStream(resourceStream)));
+      try {
+        return gzCompare(testClass, actual, expected, in1, in2);
+      } finally {
+        in1.close();
+        in2.close();
+      }
+    }
+
+    public static boolean gzCompare(Class testClass, String file1, String file2, BufferedReader in1, BufferedReader in2) throws IOException {
+
+      String s1;
+      int lineCounter = 0;
+
+      while ((s1 = in1.readLine()) != null) {
+        lineCounter++;
+
+        String s2 = in2.readLine();
+
+        if (!s1.equals(s2)) {
+          System.out.println(
+            "Files [" + file1 + "] and [" + file2 + "] differ on line "
+            + lineCounter);
+          System.out.println("One reads:  [" + s1 + "].");
+          System.out.println("Other reads:[" + s2 + "].");
+          outputFile(testClass, file1);
+          outputFile(testClass, file2);
+
+          return false;
+        }
+      }
+
+      // the second file is longer
+      if (in2.read() != -1) {
+        System.out.println(
+          "File [" + file2 + "] longer than file [" + file1 + "].");
+        outputFile(testClass, file1);
+        outputFile(testClass, file2);
+
+        return false;
+      }
+
+      return true;
+    }
+
 }

Modified: logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/FilterBasedRollingTest.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/FilterBasedRollingTest.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/FilterBasedRollingTest.java (original)
+++ logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/FilterBasedRollingTest.java Wed Apr 25 15:46:30 2007
@@ -25,8 +25,12 @@
 import org.apache.log4j.Logger;
 import org.apache.log4j.PatternLayout;
 import org.apache.log4j.filter.LevelRangeFilter;
-import org.apache.log4j.joran.JoranConfigurator;
 import org.apache.log4j.util.Compare;
+import org.apache.log4j.xml.RollingConfigurator;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
 
 
 /**
@@ -52,15 +56,24 @@
     LogManager.getLoggerRepository().resetConfiguration();
   }
 
+    private static void configure(final String configName) throws IOException {
+      String resourceName = configName;
+      int lastSlash = resourceName.lastIndexOf("/");
+      if (lastSlash >= 0) {
+          resourceName = resourceName.substring(lastSlash + 1);
+      }
+      InputStream is = TimeBasedRollingTest.class.getResourceAsStream(resourceName);
+      if (is == null) {
+          throw new FileNotFoundException("Could not find resource " + resourceName);
+      }
+      RollingConfigurator configurator = new RollingConfigurator();
+      configurator.doConfigure(is, LogManager.getLoggerRepository());
+  }
   /**
    * Test basic rolling functionality using configuration file.
    */
   public void test1() throws Exception {
-    JoranConfigurator jc = new JoranConfigurator();
-    jc.doConfigure(
-      "./input/rolling/filter1.xml", LogManager.getLoggerRepository());
-    jc.dumpErrors();
-
+    configure("./input/rolling/filter1.xml");
     common("output/filterBased-test1");
   }
 
@@ -124,10 +137,13 @@
     //  test was constructed to mimic SizeBasedRollingTest.test2
     //
     assertTrue(
-      Compare.compare(baseName + ".log", "witness/rolling/sbr-test2.log"));
+      Compare.compare(FilterBasedRollingTest.class,
+              baseName + ".log", "witness/rolling/sbr-test2.log"));
     assertTrue(
-      Compare.compare(baseName + ".0", "witness/rolling/sbr-test2.0"));
+      Compare.compare(FilterBasedRollingTest.class,
+              baseName + ".0", "witness/rolling/sbr-test2.0"));
     assertTrue(
-      Compare.compare(baseName + ".1", "witness/rolling/sbr-test2.1"));
+      Compare.compare(FilterBasedRollingTest.class,
+              baseName + ".1", "witness/rolling/sbr-test2.1"));
   }
 }

Modified: logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/RenamingTest.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/RenamingTest.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/RenamingTest.java (original)
+++ logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/RenamingTest.java Wed Apr 25 15:46:30 2007
@@ -17,16 +17,15 @@
 
 package org.apache.log4j.rolling;
 
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-
 import junit.framework.TestCase;
-
 import org.apache.log4j.ConsoleAppender;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PatternLayout;
 import org.apache.log4j.util.Compare;
+
 import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
 
 
 /**
@@ -91,13 +90,16 @@
     //            which opens test.log in another process or
     //              the test is running on a platform that allows open files to be renamed
     if (new File(rolledFile).exists()) {
-        assertTrue(Compare.compare(rolledFile, "witness/rolling/renaming.0"));
-        assertTrue(Compare.compare("output/test.log", "witness/rolling/renaming.1"));
+        assertTrue(Compare.compare(RenamingTest.class,
+                rolledFile, "witness/rolling/renaming.0"));
+        assertTrue(Compare.compare(RenamingTest.class,
+                "output/test.log", "witness/rolling/renaming.1"));
     } else {
         //
         //   otherwise the rollover should have been blocked
         //
-        assertTrue(Compare.compare("output/test.log", "witness/rolling/renaming.2"));
+        assertTrue(Compare.compare(RenamingTest.class,
+                "output/test.log", "witness/rolling/renaming.2"));
     }
   }
 }

Modified: logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/SizeBasedRollingTest.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/SizeBasedRollingTest.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/SizeBasedRollingTest.java (original)
+++ logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/SizeBasedRollingTest.java Wed Apr 25 15:46:30 2007
@@ -17,13 +17,7 @@
 
 package org.apache.log4j.rolling;
 
-import java.io.File;
-import java.io.FileOutputStream;
-
-import junit.framework.Test;
 import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.apache.log4j.Appender;
 import org.apache.log4j.ConsoleAppender;
 import org.apache.log4j.LogManager;
@@ -31,6 +25,9 @@
 import org.apache.log4j.PatternLayout;
 import org.apache.log4j.util.Compare;
 
+import java.io.File;
+import java.io.FileOutputStream;
+
 
 /**
  *
@@ -96,11 +93,14 @@
         assertTrue(new File("output/sizeBased-test1.1").exists());
         assertTrue(new File("output/sizeBased-test1.2").exists());
 
-        assertTrue(Compare.compare("output/sizeBased-test1.0",
+        assertTrue(Compare.compare(SizeBasedRollingTest.class,
+                "output/sizeBased-test1.0",
          "witness/rolling/sbr-test2.log"));
-        assertTrue(Compare.compare("output/sizeBased-test1.1",
+        assertTrue(Compare.compare(SizeBasedRollingTest.class,
+                "output/sizeBased-test1.1",
          "witness/rolling/sbr-test2.0"));
-        assertTrue(Compare.compare("output/sizeBased-test1.2",
+        assertTrue(Compare.compare(SizeBasedRollingTest.class,
+                "output/sizeBased-test1.2",
          "witness/rolling/sbr-test2.1"));
   }
 
@@ -142,11 +142,14 @@
     assertTrue(new File("output/sizeBased-test2.0").exists());
     assertTrue(new File("output/sizeBased-test2.1").exists());
 
-    assertTrue(Compare.compare("output/sizeBased-test2.log",
+    assertTrue(Compare.compare(SizeBasedRollingTest.class,
+            "output/sizeBased-test2.log",
      "witness/rolling/sbr-test2.log"));
-    assertTrue(Compare.compare("output/sizeBased-test2.0",
+    assertTrue(Compare.compare(SizeBasedRollingTest.class,
+            "output/sizeBased-test2.0",
      "witness/rolling/sbr-test2.0"));
-    assertTrue(Compare.compare("output/sizeBased-test2.1",
+    assertTrue(Compare.compare(SizeBasedRollingTest.class,
+            "output/sizeBased-test2.1",
      "witness/rolling/sbr-test2.1"));
   }
 
@@ -186,9 +189,12 @@
     assertTrue(new File("output/sbr-test3.0.gz").exists());
     assertTrue(new File("output/sbr-test3.1.gz").exists());
 
-    assertTrue(Compare.compare("output/sbr-test3.log",  "witness/rolling/sbr-test3.log"));
-    assertTrue(Compare.gzCompare("output/sbr-test3.0.gz", "witness/rolling/sbr-test3.0.gz"));
-    assertTrue(Compare.gzCompare("output/sbr-test3.1.gz", "witness/rolling/sbr-test3.1.gz"));
+    assertTrue(Compare.compare(SizeBasedRollingTest.class,
+            "output/sbr-test3.log",  "witness/rolling/sbr-test3.log"));
+    assertTrue(Compare.gzCompare(SizeBasedRollingTest.class,
+            "output/sbr-test3.0.gz", "witness/rolling/sbr-test3.0.gz"));
+    assertTrue(Compare.gzCompare(SizeBasedRollingTest.class,
+            "output/sbr-test3.1.gz", "witness/rolling/sbr-test3.1.gz"));
   }
 
     /**
@@ -230,7 +236,8 @@
 
     assertTrue(new File("output/sizeBased-test4.log").exists());
 
-    assertTrue(Compare.compare("output/sizeBased-test4.log",
+    assertTrue(Compare.compare(SizeBasedRollingTest.class,
+            "output/sizeBased-test4.log",
      "witness/rolling/sbr-test4.log"));
   }
 
@@ -289,11 +296,15 @@
         assertTrue(new File("output/sizeBased-test5.2").exists());
         assertTrue(new File("output/sizeBased-test5.3").exists());
 
-        assertTrue(Compare.compare("output/sizeBased-test5.log",
+        assertTrue(Compare.compare(
+                SizeBasedRollingTest.class,
+                "output/sizeBased-test5.log",
          "witness/rolling/sbr-test2.log"));
-        assertTrue(Compare.compare("output/sizeBased-test5.0",
+        assertTrue(Compare.compare(SizeBasedRollingTest.class,
+                "output/sizeBased-test5.0",
          "witness/rolling/sbr-test2.0"));
-        assertTrue(Compare.compare("output/sizeBased-test5.1",
+        assertTrue(Compare.compare(SizeBasedRollingTest.class,
+                "output/sizeBased-test5.1",
          "witness/rolling/sbr-test2.1"));
 
     } else {
@@ -306,7 +317,8 @@
         assertTrue(new File("output/sizeBased-test5.0").exists());
         assertTrue(new File("output/sizeBased-test5.2").exists());
 
-        assertTrue(Compare.compare("output/sizeBased-test5.log",
+        assertTrue(Compare.compare(
+                SizeBasedRollingTest.class,"output/sizeBased-test5.log",
             "witness/rolling/sbr-test4.log"));
     }
   }
@@ -352,11 +364,14 @@
     assertTrue(new File("output/sizeBased-test6.0").exists());
     assertTrue(new File("output/sizeBased-test6.1").exists());
 
-    assertTrue(Compare.compare("output/sizeBased-test6.log",
+    assertTrue(Compare.compare(SizeBasedRollingTest.class,
+            "output/sizeBased-test6.log",
      "witness/rolling/sbr-test2.log"));
-    assertTrue(Compare.compare("output/sizeBased-test6.0",
+    assertTrue(Compare.compare(SizeBasedRollingTest.class,
+            "output/sizeBased-test6.0",
      "witness/rolling/sbr-test2.0"));
-    assertTrue(Compare.compare("output/sizeBased-test6.1",
+    assertTrue(Compare.compare(SizeBasedRollingTest.class,
+            "output/sizeBased-test6.1",
      "witness/rolling/sbr-test2.1"));
   }
 

Modified: logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/TimeBasedRollingTest.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/TimeBasedRollingTest.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/TimeBasedRollingTest.java (original)
+++ logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/TimeBasedRollingTest.java Wed Apr 25 15:46:30 2007
@@ -17,19 +17,18 @@
 
 package org.apache.log4j.rolling;
 
-import junit.framework.Test;
 import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.apache.log4j.ConsoleAppender;
 import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PatternLayout;
-import org.apache.log4j.joran.JoranConfigurator;
 import org.apache.log4j.util.Compare;
+import org.apache.log4j.xml.RollingConfigurator;
 
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
 import java.text.SimpleDateFormat;
-
 import java.util.Calendar;
 import java.util.Date;
 
@@ -71,6 +70,30 @@
     LogManager.shutdown();
   }
 
+  private static boolean compare(final String actual, final String expected)
+          throws IOException {
+      return Compare.compare(TimeBasedRollingTest.class, actual, expected);
+  }
+
+  private static boolean gzCompare(final String actual, final String expected)
+            throws IOException {
+        return Compare.gzCompare(TimeBasedRollingTest.class, actual, expected);
+  }
+
+  private static void configure(final String configName) throws IOException {
+      String resourceName = configName;
+      int lastSlash = resourceName.lastIndexOf("/");
+      if (lastSlash >= 0) {
+          resourceName = resourceName.substring(lastSlash + 1);
+      }
+      InputStream is = TimeBasedRollingTest.class.getResourceAsStream(resourceName);
+      if (is == null) {
+          throw new FileNotFoundException("Could not find resource " + resourceName);
+      }
+      RollingConfigurator configurator = new RollingConfigurator();
+      configurator.doConfigure(is, LogManager.getLoggerRepository());
+  }
+
   /**
    * Test rolling without compression, activeFileName left blank, no stop/start
    */
@@ -112,7 +135,7 @@
     }
 
     for (int i = 0; i < 4; i++) {
-      assertTrue(Compare.compare(filenames[i], "witness/rolling/tbr-test1." + i));
+      assertTrue(compare(filenames[i], "witness/rolling/tbr-test1." + i));
     }
   }
 
@@ -174,7 +197,7 @@
     rfa2.close();
 
     for (int i = 0; i < 4; i++) {
-      assertTrue(Compare.compare(filenames[i], "witness/rolling/tbr-test2." + i));
+      assertTrue(compare(filenames[i], "witness/rolling/tbr-test2." + i));
     }
   }
 
@@ -223,10 +246,10 @@
     rfa.close();
 
     for (int i = 0; i < 3; i++) {
-      assertTrue(Compare.gzCompare(filenames[i], "witness/rolling/tbr-test3." + i + ".gz"));
+      assertTrue(gzCompare(filenames[i], "witness/rolling/tbr-test3." + i + ".gz"));
     }
 
-    assertTrue(Compare.compare(filenames[3], "witness/rolling/tbr-test3.3"));
+    assertTrue(compare(filenames[3], "witness/rolling/tbr-test3.3"));
   }
 
   /**
@@ -244,6 +267,7 @@
     tbrp1.setFileNamePattern("output/test4-%d{" + datePattern + "}");
     tbrp1.activateOptions();
     rfa1.setRollingPolicy(tbrp1);
+    rfa1.setAppend(false);
     rfa1.activateOptions();
     logger.addAppender(rfa1);
 
@@ -290,7 +314,7 @@
     rfa2.close();
 
     for (int i = 0; i < 4; i++) {
-      assertTrue(Compare.compare(filenames[i], "witness/rolling/tbr-test4." + i));
+      assertTrue(compare(filenames[i], "witness/rolling/tbr-test4." + i));
     }
   }
 
@@ -309,6 +333,7 @@
     rfa.setFile("output/test5.log");
     tbrp.activateOptions();
     rfa.setRollingPolicy(tbrp);
+    rfa.setAppend(false);
     rfa.activateOptions();
     logger.addAppender(rfa);
 
@@ -334,7 +359,7 @@
     }
 
     for (int i = 0; i < 4; i++) {
-      assertTrue(Compare.compare(filenames[i], "witness/rolling/tbr-test5." + i));
+      assertTrue(compare(filenames[i], "witness/rolling/tbr-test5." + i));
     }
   }
 
@@ -353,6 +378,7 @@
     rfa.setFile("output/test6.log");
     tbrp.activateOptions();
     rfa.setRollingPolicy(tbrp);
+    rfa.setAppend(false);
     rfa.activateOptions();
     logger.addAppender(rfa);
 
@@ -384,17 +410,15 @@
     rfa.close();
 
     for (int i = 0; i < 3; i++) {
-      assertTrue(Compare.gzCompare(filenames[i], "witness/rolling/tbr-test6." + i + ".gz"));
+      assertTrue(gzCompare(filenames[i], "witness/rolling/tbr-test6." + i + ".gz"));
     }
 
-    assertTrue(Compare.compare(filenames[3], "witness/rolling/tbr-test6.3"));
+    assertTrue(compare(filenames[3], "witness/rolling/tbr-test6.3"));
   }
 
   public void testWithJoran1() throws Exception {
-    JoranConfigurator jc = new JoranConfigurator();
-    jc.doConfigure("./input/rolling/time1.xml", LogManager.getLoggerRepository());
-    jc.dumpErrors();
-    
+    configure("./input/rolling/time1.xml");
+
     String datePattern = "yyyy-MM-dd_HH_mm_ss";
 
     SimpleDateFormat sdf = new SimpleDateFormat(datePattern);
@@ -421,16 +445,14 @@
     }
 
     for (int i = 0; i < 4; i++) {
-      assertTrue(Compare.compare(filenames[i], "witness/rolling/tbr-test1." + i));
+      assertTrue(compare(filenames[i], "witness/rolling/tbr-test1." + i));
     }
     
   }
   
   public void XXXtestWithJoran10() throws Exception {
-    JoranConfigurator jc = new JoranConfigurator();
-    jc.doConfigure("./input/rolling/time2.xml", LogManager.getLoggerRepository());
-    jc.dumpErrors();
-    
+    configure("./input/rolling/time2.xml");
+
     String datePattern = "yyyy-MM-dd";
 
     SimpleDateFormat sdf = new SimpleDateFormat(datePattern);
@@ -447,7 +469,7 @@
 
 
     for (int i = 0; i < 1; i++) {
-      assertTrue(Compare.compare(filenames[i], "witness/rolling/tbr-test10." + i));
+      assertTrue(compare(filenames[i], "witness/rolling/tbr-test10." + i));
     }
     
   }

Modified: logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/helper/FileNamePatternTestCase.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/helper/FileNamePatternTestCase.java?view=diff&rev=532515&r1=532416&r2=532515
==============================================================================
--- logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/helper/FileNamePatternTestCase.java (original)
+++ logging/sandbox/log4j/rolling/src/test/java/org/apache/log4j/rolling/helper/FileNamePatternTestCase.java Wed Apr 25 15:46:30 2007
@@ -15,13 +15,11 @@
  */
 package org.apache.log4j.rolling.helper;
 
+import junit.framework.TestCase;
 import org.apache.log4j.rolling.RollingPolicyBase;
 import org.apache.log4j.rolling.RolloverDescription;
 
-import junit.framework.TestCase;
-
 import java.util.Calendar;
-import org.apache.log4j.ULogger;
 
 
 /**
@@ -52,9 +50,6 @@
             return null;
         }
         public RolloverDescription rollover(final String activeName) {
-            return null;
-        }
-        public ULogger getLogger() {
             return null;
         }
         public String format(Object obj) {

Copied: logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/filter1.xml (from r532433, logging/log4j/trunk/tests/input/rolling/filter1.xml)
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/filter1.xml?view=diff&rev=532515&p1=logging/log4j/trunk/tests/input/rolling/filter1.xml&r1=532433&p2=logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/filter1.xml&r2=532515
==============================================================================
--- logging/log4j/trunk/tests/input/rolling/filter1.xml (original)
+++ logging/sandbox/log4j/rolling/src/test/resources/org/apache/log4j/rolling/filter1.xml Wed Apr 25 15:46:30 2007
@@ -16,7 +16,8 @@
     </triggeringPolicy>
     <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%m%n"/>
-    </layout>	    
+    </layout>
+    <param name="append" value="false"/>
   </appender>
   
   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message