Author: skitching
Date: Wed Jun 22 22:40:32 2005
New Revision: 193079
URL: http://svn.apache.org/viewcvs?rev=193079&view=rev
Log:
Split Log4JLogger into Log4J12Logger and Log4J13Logger
Added:
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J12Logger.java
(with props)
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J13Logger.java
(with props)
Removed:
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4JLogger.java
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4jFactory.java
Modified:
jakarta/commons/proper/logging/trunk/build.properties.sample
jakarta/commons/proper/logging/trunk/build.xml
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/CustomConfigTestCase.java
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/DefaultConfigTestCase.java
Modified: jakarta/commons/proper/logging/trunk/build.properties.sample
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/build.properties.sample?rev=193079&r1=193078&r2=193079&view=diff
==============================================================================
--- jakarta/commons/proper/logging/trunk/build.properties.sample (original)
+++ jakarta/commons/proper/logging/trunk/build.properties.sample Wed Jun 22
22:40:32 2005
@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# log4j.jar - log4j classes (see http://jakarta.apache.org/log4j)
-log4j.jar=/java/log4j/log4j.jar
+# Apache Log4j 1.2.x series
+log4j12.jar=/java/log4j/log4j-1.2.9.jar
-# Used for testing against older 1.2.x Log4J versions
-log4j12.jar=/java/log4j/log4j-1.2.7.jar
+# Apache Log4j 1.3.x series
+log4j13.jar=/java/log4j/log4j-1.3.0.jar
# logkit.jar - Avalon LogKit classes (see http://jakarta.apache.org/avalon)
logkit.jar=/java/logkit/logkit.jar
Modified: jakarta/commons/proper/logging/trunk/build.xml
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/build.xml?rev=193079&r1=193078&r2=193079&view=diff
==============================================================================
--- jakarta/commons/proper/logging/trunk/build.xml (original)
+++ jakarta/commons/proper/logging/trunk/build.xml Wed Jun 22 22:40:32 2005
@@ -46,7 +46,8 @@
<!-- The locations of necessary jar files -->
<property name="junit.jar" value="${junit.home}/junit.jar"/>
- <property name="log4j.jar"
value="${jakarta.home}/jakarta-log4j/dist/lib/log4j.jar"/>
+ <property name="log4j12.jar" value="log4j-1.2.9.jar"/>
+ <property name="log4j13.jar" value="log4j-1.3.0.jar"/>
<property name="logkit.jar"
value="${jakarta.home}/jakarta-avalon-logkit/build/log/logkit"/>
<property name="avalon-framework.jar"
value="../../Avalon-4.1.4/avalon-framework-4.1.4.jar"/>
<property name="servletapi.jar" value="servletapi-2.3.jar"/>
@@ -113,7 +114,6 @@
<path id="compile.classpath">
<pathelement location="${build.home}/classes"/>
<pathelement location="${junit.jar}"/>
- <pathelement location="${log4j.jar}"/>
<pathelement location="${logkit.jar}"/>
<pathelement location="${avalon-framework.jar}"/>
<pathelement location="${servletapi.jar}"/>
@@ -128,7 +128,6 @@
<pathelement location="${build.home}/classes"/>
<pathelement location="${build.home}/tests"/>
<pathelement location="${junit.jar}"/>
- <pathelement location="${log4j.jar}"/>
<pathelement location="${logkit.jar}"/>
<pathelement location="${avalon-framework.jar}"/>
<pathelement location="${conf.home}"/>
@@ -143,11 +142,11 @@
</path>
<!-- Construct unit test classpath (Log4J tests) -->
- <path id="test.classpath.log4j">
+ <path id="test.classpath.log4j13">
<pathelement location="${build.home}/classes"/>
<pathelement location="${build.home}/tests"/>
<pathelement location="${junit.jar}"/>
- <pathelement location="${log4j.jar}"/>
+ <pathelement location="${log4j13.jar}"/>
</path>
<!-- Construct unit test classpath (Log4J tests) -->
@@ -186,7 +185,8 @@
description="Prepare build directory">
<echo>
- Log4j: ${log4j.jar}
+ Log4j12: ${log4j12.jar}
+ Log4j13: ${log4j13.jar}
LogKit: ${logkit.jar}
Avalon-Framework: ${avalon-framework.jar}
</echo>
@@ -215,21 +215,30 @@
<target name='discovery' depends='init'>
<available property="jdk.1.4.present"
classname="java.util.logging.Logger"/>
- <available classname="org.apache.log4j.Logger"
- classpathref="compile.classpath"
- property="log4j.present"/>
+
<available property="logkit.present"
classpathref="compile.classpath"
classname="org.apache.log.Logger"/>
+
<available property="avalon-framework.present"
classpathref="compile.classpath"
classname="org.apache.avalon.framework.logger.Logger"/>
+
+ <available file="${log4j12.jar}" property="log4j12.present"/>
+ <available file="${log4j13.jar}" property="log4j13.present"/>
</target>
- <target name="log4j-warning" unless='log4j.present' depends='init,discovery'>
+ <target name="log4j12-warning" unless='log4j12.present'
depends='init,discovery'>
+ <echo>
+ *** WARNING ***
+ Log4j12 not found: Cannot Build Log4J12Logger
+ </echo>
+ </target>
+
+ <target name="log4j13-warning" unless='log4j13.present'
depends='init,discovery'>
<echo>
*** WARNING ***
- Log4j not found: Cannot Build Log4jLogger
+ Log4j13 not found: Cannot Build Log4J13Logger
</echo>
</target>
@@ -254,23 +263,25 @@
</echo>
</target>
- <target name="log4j12-warning" unless='log4j12.jar' depends='init,discovery'>
+ <target name="log4j12-test-warning" unless='log4j12.jar'
depends='init,discovery'>
<echo>
*** WARNING ***
Log4J 1.2.x Jar not found: Cannot execute 1.2.x tests
</echo>
</target>
- <target name='warning'
depends='log4j-warning,logkit-warning,jdk1.4-warning,avalon-framework-warning'/>
+ <target name='warning'
depends='log4j12-warning,logkit-warning,jdk1.4-warning,avalon-framework-warning'/>
<target name="compile-only" depends="init,discovery,warning" >
<echo message="jdk.1.4.present=${jdk.1.4.present}"/>
- <echo message="log4j.present=${log4j.present}"/>
+ <echo message="log4j12.present=${log4j12.present}"/>
+ <echo message="log4j13.present=${log4j13.present}"/>
<echo message="logkit.present=${logkit.present}"/>
<echo message="avalon-framework.present=${avalon-framework.present}"/>
+ <!-- compile everything except Log4J classes -->
<javac srcdir="${source.home}"
destdir="${build.home}/classes"
debug="${compile.debug}"
@@ -280,19 +291,60 @@
target="${target.version}">
<classpath refid="compile.classpath"/>
+
+ <exclude name="org/apache/commons/logging/impl/Log4J*.java"/>
+
<exclude
name="org/apache/commons/logging/impl/Jdk13LumberjackLogger.java"
unless="jdk.1.4.present"/>
<exclude name="org/apache/commons/logging/impl/Jdk14Logger.java"
unless="jdk.1.4.present"/>
- <exclude name="org/apache/commons/logging/impl/Log4J*.java"
- unless="log4j.present"/>
- <exclude name="org/apache/commons/logging/impl/Log4j*.java"
- unless="log4j.present"/>
<exclude name="org/apache/commons/logging/impl/LogKitLogger.java"
unless="logkit.present"/>
<exclude name="org/apache/commons/logging/impl/AvalonLogger.java"
unless="avalon-framework.present"/>
</javac>
+
+ <!-- compile the log4j1.2 support classes -->
+ <javac srcdir="${source.home}"
+ destdir="${build.home}/classes"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}"
+ source="${source.version}"
+ target="${target.version}">
+
+ <classpath refid="compile.classpath"/>
+ <classpath>
+ <!--
+ <pathelement refid="compile.classpath"/>
+ <classpath refid="compile.classpath"/>
+ -->
+ <pathelement location="${log4j12.jar}"/>
+ </classpath>
+
+ <include name="org/apache/commons/logging/impl/Log4J12Logger.java"
+ if="log4j12.present"/>
+ </javac>
+
+ <!-- compile the log4j1.3 support classes -->
+ <javac srcdir="${source.home}"
+ destdir="${build.home}/classes"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}"
+ source="${source.version}"
+ target="${target.version}">
+
+ <classpath refid="compile.classpath"/>
+ <classpath>
+ <pathelement location="${log4j13.jar}"/>
+ </classpath>
+
+ <include name="org/apache/commons/logging/impl/Log4J13Logger.java"
+ if="log4j13.present"/>
+ </javac>
+
+
<copy todir="${build.home}/classes" filtering="on">
<fileset dir="${source.home}" excludes="**/*.java"/>
</copy>
@@ -344,13 +396,13 @@
</javac>
</target>
- <target name='compile.log4j.tests' if='log4j.present'>
+ <target name='compile.log4j.tests' if='log4j12.present'>
<javac srcdir="${test.home}"
destdir="${build.home}/tests"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
- <classpath refid="test.classpath"/>
+ <classpath refid="test.classpath.log4j12"/>
<include name='**/log4j/**'/>
</javac>
</target>
@@ -389,9 +441,9 @@
basedir="${build.home}/tests"
manifest="${build.home}/conf/MANIFEST.MF">
<include name="org/apache/commons/logging/log4j/CustomConfig.properties"
- if="log4j.present"/>
+ if="log4j12.present"/>
<include name="org/apache/commons/logging/log4j/TestAppender.class"
- if="log4j.present"/>
+ if="log4j12.present"/>
</jar>
<jar jarfile="${build.home}/commons-${component.name}-tests.jar"
basedir="${build.home}/tests"
@@ -504,7 +556,7 @@
<target name="test"
- depends="test.alt-hashtable, log4j12-warning,
compile.tests,test.jdk14,test.log4j,test.simple,test.avalon,test.log4j12"
+ depends="test.alt-hashtable, log4j12-test-warning,
compile.tests,test.jdk14,test.log4j,test.simple,test.avalon,test.log4j12"
if="test.entry"
description="Run all unit test cases">
<java classname="${test.runner}" fork="yes"
@@ -567,7 +619,7 @@
<sysproperty key="org.apache.commons.logging.Log"
value="org.apache.commons.logging.impl.Jdk14Logger"/>
<arg value="org.apache.commons.logging.BasicOperationsTest"/>
- <classpath refid="test.classpath.log4j"/>
+ <classpath refid="test.classpath.log4j12"/>
</java>
@@ -660,13 +712,13 @@
</target>
- <target name="test.log4j" depends="compile.tests" if="log4j.present"
+ <target name="test.log4j" depends="compile.tests" if="log4j12.present"
description="Run unit tests specific to Log4J logging">
<echo message="Default Configuration (Log4J Auto-Recognized)"/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<arg value="org.apache.commons.logging.log4j.DefaultConfigTestCase"/>
- <classpath refid="test.classpath.log4j"/>
+ <classpath refid="test.classpath.log4j12"/>
</java>
<echo message="Default Configuration (Log4J LogFactoryImpl Selected)"/>
@@ -674,21 +726,21 @@
<sysproperty key="org.apache.commons.logging.LogFactory"
value="org.apache.commons.logging.impl.LogFactoryImpl"/>
<arg value="org.apache.commons.logging.log4j.DefaultConfigTestCase"/>
- <classpath refid="test.classpath.log4j"/>
+ <classpath refid="test.classpath.log4j12"/>
</java>
- <echo message="Default Configuration (Log4J Log4JLogger Selected)"/>
+ <echo message="Default Configuration (Log4J Log4J12Logger Selected)"/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="org.apache.commons.logging.Log"
- value="org.apache.commons.logging.impl.Log4JLogger"/>
+ value="org.apache.commons.logging.impl.Log4J12Logger"/>
<arg value="org.apache.commons.logging.log4j.DefaultConfigTestCase"/>
- <classpath refid="test.classpath.log4j"/>
+ <classpath refid="test.classpath.log4j12"/>
</java>
<echo message="Custom Configuration (Log4J Auto-Recognized)"/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<arg value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
- <classpath refid="test.classpath.log4j"/>
+ <classpath refid="test.classpath.log4j12"/>
</java>
<echo message="Custom Configuration (Log4J LogFactoryImpl Selected)"/>
@@ -696,30 +748,30 @@
<sysproperty key="org.apache.commons.logging.LogFactory"
value="org.apache.commons.logging.impl.LogFactoryImpl"/>
<arg value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
- <classpath refid="test.classpath.log4j"/>
+ <classpath refid="test.classpath.log4j12"/>
</java>
- <echo message="Custom Configuration (Log4J Log4JLogger Selected)"/>
+ <echo message="Custom Configuration (Log4J Log4J12Logger Selected)"/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="org.apache.commons.logging.Log"
- value="org.apache.commons.logging.impl.Log4JLogger"/>
+ value="org.apache.commons.logging.impl.Log4J12Logger"/>
<arg value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
- <classpath refid="test.classpath.log4j"/>
+ <classpath refid="test.classpath.log4j12"/>
</java>
<echo message="Basic Operations"/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="org.apache.commons.logging.Log"
- value="org.apache.commons.logging.impl.Log4JLogger"/>
+ value="org.apache.commons.logging.impl.Log4J12Logger"/>
<arg value="org.apache.commons.logging.BasicOperationsTest"/>
- <classpath refid="test.classpath.log4j"/>
+ <classpath refid="test.classpath.log4j12"/>
</java>
<echo message="Hierarchy Configuration API (Log4J Auto-Recognized)"/>
<java classname="${test.wrapper}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="wrapper.hierarchy" value="API"/>
<sysproperty key="wrapper.junit" value="${junit.jar}"/>
- <sysproperty key="wrapper.log4j" value="${log4j.jar}"/>
+ <sysproperty key="wrapper.log4j" value="${log4j12.jar}"/>
<sysproperty key="wrapper.target" value="${build.home}"/>
<sysproperty key="wrapper.testcase"
value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
@@ -733,7 +785,7 @@
<java classname="${test.wrapper}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="wrapper.hierarchy" value="API"/>
<sysproperty key="wrapper.junit" value="${junit.jar}"/>
- <sysproperty key="wrapper.log4j" value="${log4j.jar}"/>
+ <sysproperty key="wrapper.log4j" value="${log4j12.jar}"/>
<sysproperty key="wrapper.target" value="${build.home}"/>
<sysproperty key="wrapper.testcase"
value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
@@ -745,16 +797,16 @@
<classpath refid="test.classpath.wrap"/>
</java>
- <echo message="Hierarchy Configuration API (Log4J Log4JLogger Selected)"/>
+ <echo message="Hierarchy Configuration API (Log4J Log4J12Logger
Selected)"/>
<java classname="${test.wrapper}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="wrapper.hierarchy" value="API"/>
<sysproperty key="wrapper.junit" value="${junit.jar}"/>
- <sysproperty key="wrapper.log4j" value="${log4j.jar}"/>
+ <sysproperty key="wrapper.log4j" value="${log4j12.jar}"/>
<sysproperty key="wrapper.target" value="${build.home}"/>
<sysproperty key="wrapper.testcase"
value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
<sysproperty key="org.apache.commons.logging.Log"
- value="org.apache.commons.logging.impl.Log4JLogger"/>
+ value="org.apache.commons.logging.impl.Log4J12Logger"/>
<sysproperty key="commons.logging.jar" value="${core.jar.name}"/>
<sysproperty key="commons.logging.api.jar" value="${api.jar.name}"/>
<sysproperty key="commons.logging.appenders.jar"
value="${appenders.jar.name}"/>
@@ -765,7 +817,7 @@
<java classname="${test.wrapper}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="wrapper.hierarchy" value="FULL"/>
<sysproperty key="wrapper.junit" value="${junit.jar}"/>
- <sysproperty key="wrapper.log4j" value="${log4j.jar}"/>
+ <sysproperty key="wrapper.log4j" value="${log4j12.jar}"/>
<sysproperty key="wrapper.target" value="${build.home}"/>
<sysproperty key="wrapper.testcase"
value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
@@ -779,7 +831,7 @@
<java classname="${test.wrapper}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="wrapper.hierarchy" value="FULL"/>
<sysproperty key="wrapper.junit" value="${junit.jar}"/>
- <sysproperty key="wrapper.log4j" value="${log4j.jar}"/>
+ <sysproperty key="wrapper.log4j" value="${log4j12.jar}"/>
<sysproperty key="wrapper.target" value="${build.home}"/>
<sysproperty key="wrapper.testcase"
value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
@@ -791,16 +843,16 @@
<classpath refid="test.classpath.wrap"/>
</java>
- <echo message="Hierarchy Configuration FULL (Log4J Log4JLogger Selected)"/>
+ <echo message="Hierarchy Configuration FULL (Log4J Log4J12Logger
Selected)"/>
<java classname="${test.wrapper}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="wrapper.hierarchy" value="FULL"/>
<sysproperty key="wrapper.junit" value="${junit.jar}"/>
- <sysproperty key="wrapper.log4j" value="${log4j.jar}"/>
+ <sysproperty key="wrapper.log4j" value="${log4j12.jar}"/>
<sysproperty key="wrapper.target" value="${build.home}"/>
<sysproperty key="wrapper.testcase"
value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
<sysproperty key="org.apache.commons.logging.Log"
- value="org.apache.commons.logging.impl.Log4JLogger"/>
+ value="org.apache.commons.logging.impl.Log4J12Logger"/>
<sysproperty key="commons.logging.jar" value="${core.jar.name}"/>
<sysproperty key="commons.logging.api.jar" value="${api.jar.name}"/>
<sysproperty key="commons.logging.appenders.jar"
value="${appenders.jar.name}"/>
@@ -885,10 +937,10 @@
<classpath refid="test.classpath.log4j12"/>
</java>
- <echo message="Default Configuration (Log4J Log4JLogger Selected)"/>
+ <echo message="Default Configuration (Log4J Log4J12Logger Selected)"/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="org.apache.commons.logging.Log"
- value="org.apache.commons.logging.impl.Log4JLogger"/>
+ value="org.apache.commons.logging.impl.Log4J12Logger"/>
<arg value="org.apache.commons.logging.log4j.DefaultConfigTestCase"/>
<classpath refid="test.classpath.log4j12"/>
</java>
@@ -907,10 +959,10 @@
<classpath refid="test.classpath.log4j12"/>
</java>
- <echo message="Custom Configuration (Log4J Log4JLogger Selected)"/>
+ <echo message="Custom Configuration (Log4J Log4J12Logger Selected)"/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="org.apache.commons.logging.Log"
- value="org.apache.commons.logging.impl.Log4JLogger"/>
+ value="org.apache.commons.logging.impl.Log4J12Logger"/>
<arg value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
<classpath refid="test.classpath.log4j12"/>
</java>
@@ -918,7 +970,7 @@
<echo message="Basic Operations"/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="org.apache.commons.logging.Log"
- value="org.apache.commons.logging.impl.Log4JLogger"/>
+ value="org.apache.commons.logging.impl.Log4J12Logger"/>
<arg value="org.apache.commons.logging.BasicOperationsTest"/>
<classpath refid="test.classpath.log4j12"/>
</java>
@@ -927,7 +979,7 @@
<java classname="${test.wrapper}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="wrapper.hierarchy" value="API"/>
<sysproperty key="wrapper.junit" value="${junit.jar}"/>
- <sysproperty key="wrapper.log4j" value="${log4j.jar}"/>
+ <sysproperty key="wrapper.log4j" value="${log4j12.jar}"/>
<sysproperty key="wrapper.target" value="${build.home}"/>
<sysproperty key="wrapper.testcase"
value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
@@ -941,7 +993,7 @@
<java classname="${test.wrapper}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="wrapper.hierarchy" value="API"/>
<sysproperty key="wrapper.junit" value="${junit.jar}"/>
- <sysproperty key="wrapper.log4j" value="${log4j.jar}"/>
+ <sysproperty key="wrapper.log4j" value="${log4j12.jar}"/>
<sysproperty key="wrapper.target" value="${build.home}"/>
<sysproperty key="wrapper.testcase"
value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
@@ -953,16 +1005,16 @@
<classpath refid="test.classpath.wrap"/>
</java>
- <echo message="Hierarchy Configuration API (Log4J Log4JLogger Selected)"/>
+ <echo message="Hierarchy Configuration API (Log4J Log4J12Logger
Selected)"/>
<java classname="${test.wrapper}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="wrapper.hierarchy" value="API"/>
<sysproperty key="wrapper.junit" value="${junit.jar}"/>
- <sysproperty key="wrapper.log4j" value="${log4j.jar}"/>
+ <sysproperty key="wrapper.log4j" value="${log4j12.jar}"/>
<sysproperty key="wrapper.target" value="${build.home}"/>
<sysproperty key="wrapper.testcase"
value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
<sysproperty key="org.apache.commons.logging.Log"
- value="org.apache.commons.logging.impl.Log4JLogger"/>
+ value="org.apache.commons.logging.impl.Log4J12Logger"/>
<sysproperty key="commons.logging.jar" value="${core.jar.name}"/>
<sysproperty key="commons.logging.api.jar" value="${api.jar.name}"/>
<sysproperty key="commons.logging.appenders.jar"
value="${appenders.jar.name}"/>
@@ -999,7 +1051,7 @@
<classpath refid="test.classpath.wrap"/>
</java>
- <echo message="Hierarchy Configuration FULL (Log4J Log4JLogger Selected)"/>
+ <echo message="Hierarchy Configuration FULL (Log4J Log4J12Logger
Selected)"/>
<java classname="${test.wrapper}" fork="yes"
failonerror="${test.failonerror}">
<sysproperty key="wrapper.hierarchy" value="FULL"/>
<sysproperty key="wrapper.junit" value="${junit.jar}"/>
@@ -1008,7 +1060,7 @@
<sysproperty key="wrapper.testcase"
value="org.apache.commons.logging.log4j.CustomConfigTestCase"/>
<sysproperty key="org.apache.commons.logging.Log"
- value="org.apache.commons.logging.impl.Log4JLogger"/>
+ value="org.apache.commons.logging.impl.Log4J12Logger"/>
<sysproperty key="commons.logging.jar" value="${core.jar.name}"/>
<sysproperty key="commons.logging.api.jar" value="${api.jar.name}"/>
<sysproperty key="commons.logging.appenders.jar"
value="${appenders.jar.name}"/>
Added:
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J12Logger.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J12Logger.java?rev=193079&view=auto
==============================================================================
---
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J12Logger.java
(added)
+++
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J12Logger.java
Wed Jun 22 22:40:32 2005
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.logging.impl;
+
+import java.io.Serializable;
+import org.apache.commons.logging.Log;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
+import org.apache.log4j.Level;
+
+/**
+ * Implementation of [EMAIL PROTECTED] Log} that maps directly to a
+ * <strong>Logger</strong> for log4J version 1.2.
+ * <p>
+ * Initial configuration of the corresponding Logger instances should be done
+ * in the usual manner, as outlined in the Log4J documentation.
+ * <p>
+ * The reason this logger is distinct from the 1.3 logger is that in version
1.2
+ * of Log4J:
+ * <ul>
+ * <li>class Logger takes Priority parameters not Level parameters.
+ * <li>class Level extends Priority
+ * </ul>
+ * Log4J1.3 is expected to change Level so it no longer extends Priority,
which is
+ * a non-binary-compatible change. The class generated by compiling this code
against
+ * log4j 1.2 will therefore not run against log4j 1.3.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Scott Sanders</a>
+ * @author Rod Waldhoff
+ * @author Robert Burrell Donkin
+ * @version $Id$
+ */
+
+public class Log4J12Logger implements Log, Serializable {
+
+ // ------------------------------------------------------------- Attributes
+
+ /** The fully qualified name of the Log4J12Logger class. */
+ private static final String FQCN = Log4J12Logger.class.getName();
+
+ /** Log to this logger */
+ private transient Logger logger = null;
+
+ /** Logger name */
+ private String name = null;
+
+ private static Priority traceLevel;
+
+ // ------------------------------------------------------------
+ // Static Initializer.
+ //
+ // Note that this must come after the static variable declarations
+ // otherwise initialiser expressions associated with those variables
+ // will override any settings done here.
+ //
+ // Verify that log4j is available, and that it is version 1.2.
+ // If an ExceptionInInitializerError is generated, then LogFactoryImpl
+ // will treat that as meaning that the appropriate underlying logging
+ // library is just not present - if discovery is in progress then
+ // discovery will continue.
+ // ------------------------------------------------------------
+
+ static {
+ if (!Priority.class.isAssignableFrom(Level.class)) {
+ // nope, this is log4j 1.3, so force an ExceptionInInitializerError
+ throw new InstantiationError("Log4J 1.2 not available");
+ }
+
+ // Releases of log4j1.2 >= 1.2.12 have Priority.TRACE available,
earlier
+ // versions do not. If TRACE is not available, then we have to map
+ // calls to Log.trace(...) onto the DEBUG level.
+
+ try {
+ traceLevel = (Priority)
Priority.class.getDeclaredField("TRACE").get(null);
+ } catch(Exception ex) {
+ // ok, trace not available
+ traceLevel = Priority.DEBUG;
+ }
+ }
+
+
+ // ------------------------------------------------------------ Constructor
+
+ public Log4J12Logger() {
+ }
+
+
+ /**
+ * Base constructor.
+ */
+ public Log4J12Logger(String name) {
+ this.name = name;
+ this.logger = getLogger();
+ }
+
+ /** For use with a log4j factory.
+ */
+ public Log4J12Logger(Logger logger ) {
+ this.name = logger.getName();
+ this.logger=logger;
+ }
+
+
+ // ---------------------------------------------------------
+ // Implementation
+ //
+ // Note that in the methods below the Priority class is used to define
+ // levels even though the Level class is supported in 1.2. This is done
+ // so that at compile time the call definitely resolves to a call to
+ // a method that takes a Priority rather than one that takes a Level.
+ //
+ // The Category class (and hence its subclass Logger) in version 1.2 only
+ // has methods that take Priority objects. The Category class (and hence
+ // Logger class) in version 1.3 has methods that take both Priority and
+ // Level objects. This means that if we use Level here, and compile
+ // against log4j 1.3 then calls would be bound to the versions of
+ // methods taking Level objects and then would fail to run against
+ // version 1.2 of log4j.
+ // ---------------------------------------------------------
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>TRACE</code> priority.
+ * When using a log4j version that does not support the <code>TRACE</code>
+ * level, the message will be logged at the <code>DEBUG</code> level.
+ */
+ public void trace(Object message) {
+ getLogger().log(FQCN, traceLevel, message, null );
+ }
+
+
+ /**
+ * Log an error to the Log4j Logger with <code>TRACE</code> priority.
+ * When using a log4j version that does not support the <code>TRACE</code>
+ * level, the message will be logged at the <code>DEBUG</code> level.
+ */
+ public void trace(Object message, Throwable t) {
+ getLogger().log(FQCN, traceLevel, message, t );
+ }
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>DEBUG</code> priority.
+ */
+ public void debug(Object message) {
+ getLogger().log(FQCN, Priority.DEBUG, message, null );
+ }
+
+ /**
+ * Log an error to the Log4j Logger with <code>DEBUG</code> priority.
+ */
+ public void debug(Object message, Throwable t) {
+ getLogger().log(FQCN, Priority.DEBUG, message, t );
+ }
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>INFO</code> priority.
+ */
+ public void info(Object message) {
+ getLogger().log(FQCN, Priority.INFO, message, null );
+ }
+
+
+ /**
+ * Log an error to the Log4j Logger with <code>INFO</code> priority.
+ */
+ public void info(Object message, Throwable t) {
+ getLogger().log(FQCN, Priority.INFO, message, t );
+ }
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>WARN</code> priority.
+ */
+ public void warn(Object message) {
+ getLogger().log(FQCN, Priority.WARN, message, null );
+ }
+
+
+ /**
+ * Log an error to the Log4j Logger with <code>WARN</code> priority.
+ */
+ public void warn(Object message, Throwable t) {
+ getLogger().log(FQCN, Priority.WARN, message, t );
+ }
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>ERROR</code> priority.
+ */
+ public void error(Object message) {
+ getLogger().log(FQCN, Priority.ERROR, message, null );
+ }
+
+
+ /**
+ * Log an error to the Log4j Logger with <code>ERROR</code> priority.
+ */
+ public void error(Object message, Throwable t) {
+ getLogger().log(FQCN, Priority.ERROR, message, t );
+ }
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>FATAL</code> priority.
+ */
+ public void fatal(Object message) {
+ getLogger().log(FQCN, Priority.FATAL, message, null );
+ }
+
+
+ /**
+ * Log an error to the Log4j Logger with <code>FATAL</code> priority.
+ */
+ public void fatal(Object message, Throwable t) {
+ getLogger().log(FQCN, Priority.FATAL, message, t );
+ }
+
+
+ /**
+ * Return the native Logger instance we are using.
+ */
+ public Logger getLogger() {
+ if (logger == null) {
+ logger = Logger.getLogger(name);
+ }
+ return (this.logger);
+ }
+
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>DEBUG</code>
priority.
+ */
+ public boolean isDebugEnabled() {
+ return getLogger().isDebugEnabled();
+ }
+
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>ERROR</code>
priority.
+ */
+ public boolean isErrorEnabled() {
+ return getLogger().isEnabledFor(Priority.ERROR);
+ }
+
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>FATAL</code>
priority.
+ */
+ public boolean isFatalEnabled() {
+ return getLogger().isEnabledFor(Priority.FATAL);
+ }
+
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>INFO</code>
priority.
+ */
+ public boolean isInfoEnabled() {
+ return getLogger().isInfoEnabled();
+ }
+
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>TRACE</code>
priority.
+ * When using a log4j version that does not support the TRACE level, this
call
+ * will report whether <code>DEBUG</code> is enabled or not.
+ */
+ public boolean isTraceEnabled() {
+ return getLogger().isEnabledFor(traceLevel);
+ }
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>WARN</code>
priority.
+ */
+ public boolean isWarnEnabled() {
+ return getLogger().isEnabledFor(Priority.WARN);
+ }
+}
Propchange:
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J12Logger.java
------------------------------------------------------------------------------
svn:keywords = Id
Added:
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J13Logger.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J13Logger.java?rev=193079&view=auto
==============================================================================
---
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J13Logger.java
(added)
+++
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J13Logger.java
Wed Jun 22 22:40:32 2005
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.commons.logging.impl;
+
+import java.io.Serializable;
+import org.apache.commons.logging.Log;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+
+/**
+ * Implementation of [EMAIL PROTECTED] Log} that maps directly to a
+ * <strong>Logger</strong> for log4J version 1.3 or later.
+ * <p>
+ * Initial configuration of the corresponding Logger instances should be done
+ * in the usual manner, as outlined in the Log4J documentation.
+ * <p>
+ * The reason this logger is distinct from the 1.2 logger is that in version
1.3
+ * of Log4J, classes Logger and Level should be used. However code that uses
+ * those classes and is compiled against log4j1.2 will not run against 1.3. And
+ * code that uses those classes and is compiled against log4j1.3 will not run
+ * against 1.2.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Scott Sanders</a>
+ * @author Rod Waldhoff
+ * @author Robert Burrell Donkin
+ * @version $Id$
+ */
+public class Log4J13Logger implements Log, Serializable {
+
+ // Verify that log4j is available, and that it is version 1.3 or later.
+ // If an ExceptionInInitializerError is generated, then LogFactoryImpl
+ // will treat that as meaning that the appropriate underlying logging
+ // library is just not present - if discovery is in progress then
+ // discovery will continue.
+ //
+ // Note that in log4j 1.2, Priority is effectively deprecated. Its
+ // replacement, Level, extends Priority. In log4j 1.3, Priority is still
+ // included but instead extends Level. In later versions, Priority may
+ // not be included at all.
+ static {
+ Class levelSuperclass = Level.class.getSuperclass();
+ if (levelSuperclass.getName().equals("org.apache.log4j.Priority")) {
+ // nope, this is log4j 1.2, so force an ExceptionInInitializerError
+ throw new InstantiationError("Log4J 1.3 not available");
+ }
+ }
+
+ // ------------------------------------------------------------- Attributes
+
+ /** The fully qualified name of the Log4JLogger class. */
+ private static final String FQCN = Log4J13Logger.class.getName();
+
+ /** Log to this logger */
+ private transient Logger logger = null;
+
+ /** Logger name */
+ private String name = null;
+
+
+ // ------------------------------------------------------------ Constructor
+
+ public Log4J13Logger() {
+ }
+
+
+ /**
+ * Base constructor.
+ */
+ public Log4J13Logger(String name) {
+ this.name = name;
+ this.logger = getLogger();
+ }
+
+ /** For use with a log4j factory.
+ */
+ public Log4J13Logger(Logger logger ) {
+ this.name = logger.getName();
+ this.logger=logger;
+ }
+
+
+ // --------------------------------------------------------- Implementation
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>TRACE</code> priority.
+ */
+ public void trace(Object message) {
+ getLogger().log(FQCN, Level.TRACE, message, null );
+ }
+
+
+ /**
+ * Log an error to the Log4j Logger with <code>TRACE</code> priority.
+ */
+ public void trace(Object message, Throwable t) {
+ getLogger().log(FQCN, Level.TRACE, message, t );
+ }
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>DEBUG</code> priority.
+ */
+ public void debug(Object message) {
+ getLogger().log(FQCN, Level.DEBUG, message, null );
+ }
+
+ /**
+ * Log an error to the Log4j Logger with <code>DEBUG</code> priority.
+ */
+ public void debug(Object message, Throwable t) {
+ getLogger().log(FQCN, Level.DEBUG, message, t );
+ }
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>INFO</code> priority.
+ */
+ public void info(Object message) {
+ getLogger().log(FQCN, Level.INFO, message, null );
+ }
+
+
+ /**
+ * Log an error to the Log4j Logger with <code>INFO</code> priority.
+ */
+ public void info(Object message, Throwable t) {
+ getLogger().log(FQCN, Level.INFO, message, t );
+ }
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>WARN</code> priority.
+ */
+ public void warn(Object message) {
+ getLogger().log(FQCN, Level.WARN, message, null );
+ }
+
+
+ /**
+ * Log an error to the Log4j Logger with <code>WARN</code> priority.
+ */
+ public void warn(Object message, Throwable t) {
+ getLogger().log(FQCN, Level.WARN, message, t );
+ }
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>ERROR</code> priority.
+ */
+ public void error(Object message) {
+ getLogger().log(FQCN, Level.ERROR, message, null );
+ }
+
+
+ /**
+ * Log an error to the Log4j Logger with <code>ERROR</code> priority.
+ */
+ public void error(Object message, Throwable t) {
+ getLogger().log(FQCN, Level.ERROR, message, t );
+ }
+
+
+ /**
+ * Log a message to the Log4j Logger with <code>FATAL</code> priority.
+ */
+ public void fatal(Object message) {
+ getLogger().log(FQCN, Level.FATAL, message, null );
+ }
+
+
+ /**
+ * Log an error to the Log4j Logger with <code>FATAL</code> priority.
+ */
+ public void fatal(Object message, Throwable t) {
+ getLogger().log(FQCN, Level.FATAL, message, t );
+ }
+
+
+ /**
+ * Return the native Logger instance we are using.
+ */
+ public Logger getLogger() {
+ if (logger == null) {
+ logger = Logger.getLogger(name);
+ }
+ return (this.logger);
+ }
+
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>DEBUG</code>
priority.
+ */
+ public boolean isDebugEnabled() {
+ return getLogger().isDebugEnabled();
+ }
+
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>ERROR</code>
priority.
+ */
+ public boolean isErrorEnabled() {
+ return getLogger().isEnabledFor(Level.ERROR);
+ }
+
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>FATAL</code>
priority.
+ */
+ public boolean isFatalEnabled() {
+ return getLogger().isEnabledFor(Level.FATAL);
+ }
+
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>INFO</code>
priority.
+ */
+ public boolean isInfoEnabled() {
+ return getLogger().isInfoEnabled();
+ }
+
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>TRACE</code>
priority.
+ */
+ public boolean isTraceEnabled() {
+ return getLogger().isTraceEnabled();
+ }
+
+ /**
+ * Check whether the Log4j Logger used is enabled for <code>WARN</code>
priority.
+ */
+ public boolean isWarnEnabled() {
+ return getLogger().isEnabledFor(Level.WARN);
+ }
+}
Propchange:
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4J13Logger.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java?rev=193079&r1=193078&r2=193079&view=diff
==============================================================================
---
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
(original)
+++
jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
Wed Jun 22 22:40:32 2005
@@ -149,7 +149,8 @@
* but broken/unusable for some reason.
*/
private static final String[] classesToDiscover = {
- "org.apache.commons.logging.impl.Log4JLogger",
+ "org.apache.commons.logging.impl.Log4J13Logger",
+ "org.apache.commons.logging.impl.Log4J12Logger",
"org.apache.commons.logging.impl.Jdk14Logger",
"org.apache.commons.logging.impl.Jdk13LumberjackLogger",
"org.apache.commons.logging.impl.SimpleLog"
Modified:
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/CustomConfigTestCase.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/CustomConfigTestCase.java?rev=193079&r1=193078&r2=193079&view=diff
==============================================================================
---
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/CustomConfigTestCase.java
(original)
+++
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/CustomConfigTestCase.java
Wed Jun 22 22:40:32 2005
@@ -182,7 +182,7 @@
assertNotNull("Log exists", log);
assertEquals("Log class",
- "org.apache.commons.logging.impl.Log4JLogger",
+ "org.apache.commons.logging.impl.Log4J12Logger",
log.getClass().getName());
// Assert which logging levels have been enabled
Modified:
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/DefaultConfigTestCase.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/DefaultConfigTestCase.java?rev=193079&r1=193078&r2=193079&view=diff
==============================================================================
---
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/DefaultConfigTestCase.java
(original)
+++
jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/DefaultConfigTestCase.java
Wed Jun 22 22:40:32 2005
@@ -154,7 +154,7 @@
assertNotNull("Log exists", log);
assertEquals("Log class",
- "org.apache.commons.logging.impl.Log4JLogger",
+ "org.apache.commons.logging.impl.Log4J12Logger",
log.getClass().getName());
// Can we call level checkers with no exceptions?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]