You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sk...@apache.org on 2006/03/02 03:31:44 UTC

svn commit: r382246 - in /jakarta/commons/proper/logging/contrib/simon: ./ jcl2/ jcl2/src/ jcl2/src/conf/ jcl2/src/core-dynamic/ jcl2/src/core-dynamic/java/ jcl2/src/core-dynamic/java/org/ jcl2/src/core-dynamic/java/org/apache/ jcl2/src/core-dynamic/ja...

Author: skitching
Date: Wed Mar  1 18:31:39 2006
New Revision: 382246

URL: http://svn.apache.org/viewcvs?rev=382246&view=rev
Log:
Suggested implementation of JCL 2.x

Added:
    jakarta/commons/proper/logging/contrib/simon/
    jakarta/commons/proper/logging/contrib/simon/jcl2/
    jakarta/commons/proper/logging/contrib/simon/jcl2/build.xml
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/conf/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/conf/MANIFEST.MF
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-dynamic/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-dynamic/java/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-dynamic/java/org/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-dynamic/java/org/apache/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-dynamic/java/org/apache/commons/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-dynamic/java/org/apache/commons/logging/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/conf/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/conf/org.apache.commons.logging.LogFactory
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/apache/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/apache/commons/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/apache/commons/logging/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/apache/commons/logging/LogFactoryStatic.java   (with props)
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Log.java   (with props)
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogConfigurationException.java   (with props)
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogFactory.java   (with props)
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogHandler.java   (with props)
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Utils.java   (with props)
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/dynamic/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/dynamic/java/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/dynamic/java/org/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/dynamic/java/org/apache/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/dynamic/java/org/apache/commons/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/dynamic/java/org/apache/commons/logging/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/jul/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/jul/java/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/jul/java/org/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/jul/java/org/apache/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/jul/java/org/apache/commons/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/jul/java/org/apache/commons/logging/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/log4j/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/log4j/java/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/log4j/java/org/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/log4j/java/org/apache/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/log4j/java/org/apache/commons/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/log4j/java/org/apache/commons/logging/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/conf/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/conf/org.apache.commons.logging.LogHandler
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLog.java   (with props)
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java   (with props)
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/conf/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/conf/org.apache.commons.logging.LogHandler
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLog.java   (with props)
    jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLogHandler.java   (with props)

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/build.xml?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/build.xml (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/build.xml Wed Mar  1 18:31:39 2006
@@ -0,0 +1,373 @@
+<!--
+
+ Copyright 2001-2006 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.
+
+-->
+
+<!--
+  - Ant build file for commons-logging.
+  -
+  - Quick build instructions:
+  -  * ant getlibs
+  -  * cp build.properties.sample build.properties
+  -  * ant -lib lib/junit-3.8.1.jar dist 
+  -
+  - Note that this build file uses the optional <junit> task. While the
+  - task "adapter" class comes by default with ant 1.6+, the junit libraries
+  - (3.8.1 or later) are also required to be made available to ant. This
+  - requires that you do one of the following:
+  -  * create directory ~/.ant/lib and place the junit jar there
+  -  * put the junit jar in $ANT_HOME/lib
+  -  * run ant as "ant -lib path-to-junit-jar"
+  -  * put the junit jar in $CLASSPATH
+  -
+  - Note when building JCL for release it is strongly recommended that a 1.2 JVM
+  - is used for the main compile and the home.jdk4 property used to specify
+  - the path to a 1.4 J2SDK. This will be used to compile those classes
+  - which require the 1.4 API. 
+  -
+  - $Id: build.xml 381232 2006-02-27 02:37:19Z skitching $
+  -->
+
+<project name="Logging" default="compile" basedir=".">
+
+
+<!-- ========== Initialize Properties ===================================== -->
+
+
+  <property file="build.properties"/>                <!-- Component local   -->
+  <property file="../build.properties"/>             <!-- Commons local     -->
+  <property file="${user.home}/build.properties"/>   <!-- User local        -->
+
+
+<!-- ========== External Dependencies ===================================== -->
+
+
+  <!-- The directories corresponding to your necessary dependencies -->
+  <property name="junit.home"              value="/usr/local/junit3.5"/>
+  <property name="jakarta.home"            value="../.."/>
+
+  <!--
+    - The names of the unit tests to run. By default all tests are run, but
+    - this can be overridden from the command line by something like:
+    -   ant -Dtestmatch=**/FooTestCase test
+    -->
+  <property name="testmatch" value="**/*TestCase"/>
+
+
+<!-- ========== Derived Values ============================================ -->
+
+
+  <!-- The locations of necessary jar files -->
+  <property name="junit.jar"               value="junit-3.8.1.jar"/>
+  <property name="log4j12.jar"             value="log4j-1.2.12.jar"/>
+  <property name="log4j13.jar"             value="log4j-1.3.0.jar"/>
+  <property name="servletapi.jar"          value="servletapi-2.3.jar"/>
+
+
+<!-- ========== Component Declarations ==================================== -->
+
+
+  <!-- The name of this component -->
+  <property name="component.name"          value="logging"/>
+
+  <!-- The primary package name of this component -->
+  <property name="component.package"       value="org.apache.commons.logging"/>
+
+  <!-- The title of this component -->
+  <property name="component.title"         value="Logging Wrapper Library"/>
+
+  <!-- The current version number of this component -->
+  <property name="component.version"       value="2.0-dev"/>
+
+  <!-- The base directory for compilation targets -->
+  <property name="build.home"              value="${basedir}/target"/>
+
+  <!-- The base directory for component configuration files -->
+  <property name="conf.home"               value="src/conf"/>
+
+  <!-- The base directory for distribution targets -->
+  <property name="dist.home"               value="dist"/>
+
+  <!-- The base directory for releases  -->
+  <property name="artifacts.home"               value="artifacts"/>
+
+  <!-- The base directory for component sources -->
+  <property name="source.home"             value="src/java"/>
+
+  <!-- The base directory for unit test sources -->
+  <property name="test.home"               value="src/test"/>
+
+  <!-- jar names -->
+  <property name="core.jar.name" value="commons-${component.name}-${component.version}.jar"/>
+  <property name="api.jar.name" value="commons-${component.name}-api-${component.version}.jar"/>
+  <property name="adapters.jar.name" value="commons-${component.name}-adapters-${component.version}.jar"/>
+  <property name="src.ide.name" value="commons-${component.name}-${component.version}-ide.zip"/>
+
+<!-- ========== Compiler Defaults ========================================= -->
+
+  <!-- Version of java class files to generate. -->
+  <property name="target.version" value="1.1"/>
+
+  <!-- Version of java source to accept -->
+  <property name="source.version" value="1.2"/>
+
+  <!-- Should Java compilations set the 'debug' compiler option? -->
+  <property name="compile.debug"           value="true"/>
+
+  <!-- Should Java compilations set the 'deprecation' compiler option? -->
+  <property name="compile.deprecation"     value="false"/>
+
+  <!-- Should Java compilations set the 'optimize' compiler option? -->
+  <property name="compile.optimize"        value="false"/>
+
+  <!-- Construct compile classpath -->
+  <path id="compile.classpath">
+    <pathelement location="${servletapi.jar}"/>
+  </path>
+
+
+<!-- ========== Test Execution Defaults =================================== -->
+
+  <!-- 
+    - Construct unit test classpath (generic tests).
+    -
+    - Note that unit tests that use the PathableTestSuite approach don't need
+    - any of this (except junit). However unit tests that don't use PathableTestSuite
+    - to configure their classpath will need the basic classes to be provided
+    - via this mechanism.
+    -->
+  <path id="test.classpath">
+    <pathelement location="${build.home}/classes"/>
+    <pathelement location="${build.home}/tests"/>
+    <pathelement location="${junit.jar}"/>
+    <pathelement location="${logkit.jar}"/>
+    <pathelement location="${avalon-framework.jar}"/>
+    <pathelement location="${conf.home}"/>
+    <pathelement location="${servletapi.jar}"/>
+  </path>
+
+  <!-- Construct unit test classpath (Log4J tests) -->
+  <path id="test.classpath.log4j13">
+    <pathelement location="${build.home}/classes"/>
+    <pathelement location="${build.home}/tests"/>
+    <pathelement location="${junit.jar}"/>
+    <pathelement location="${log4j13.jar}"/>
+  </path>
+
+  <!-- Construct unit test classpath (Log4J tests) -->
+  <path id="test.classpath.log4j12">
+    <pathelement location="${build.home}/classes"/>
+    <pathelement location="${build.home}/tests"/>
+    <pathelement location="${junit.jar}"/>
+    <pathelement location="${log4j12.jar}"/>
+  </path>
+
+  <!-- Construct javadoc classpath -->
+  <path id="javadoc.classpath">
+    <path refid="compile.classpath"/>
+    <pathelement location="${log4j12.jar}"/>
+  </path>
+
+  <!-- Should all tests fail if one does? -->
+  <property name="test.failonerror"        value="true"/>
+
+  <!-- The test runner to execute -->
+  <property name="test.runner" value="junit.textui.TestRunner"/>
+
+  <!-- libs to pass to the tests -->
+  <property name="test.sysprops.testclasses" value="${build.home}/tests"/>
+  <property name="test.sysprops.log4j12" value="${log4j12.jar}"/>
+  <property name="test.sysprops.log4j13" value="${log4j13.jar}"/>
+  <property name="test.sysprops.logkit" value="${logkit.jar}"/>
+  <property name="test.sysprops.servletapi" value="${servletapi.jar}"/>
+  <property name="test.sysprops.commons-logging" value="${build.home}/${core.jar.name}"/>
+  <property name="test.sysprops.commons-logging-api" value="${build.home}/${api.jar.name}"/>
+  <property name="test.sysprops.commons-logging-adapters" value="${build.home}/${adapters.jar.name}"/>
+  <propertyset id="test-lib-props">
+    <propertyref prefix="test.sysprops."/>
+    <mapper type="glob" from="test.sysprops.*" to="*"/>
+  </propertyset>
+
+<!-- ========== Executable Targets ======================================== -->
+
+
+  <!--
+    - Running this target will download all the necessary dependencies into the "lib" subdirectory.
+    -->
+  <property name="getlibs.base" value="http://www.ibiblio.org/maven"/>
+  <target name="getlibs">
+    <mkdir dir="lib"/>
+    <get dest="lib/junit-3.8.1.jar" src="${getlibs.base}/junit/jars/junit-3.8.1.jar"/>
+    <get dest="lib/logkit-1.0.1.jar" src="${getlibs.base}/logkit/jars/logkit-1.0.1.jar"/>
+    <get dest="lib/avalon-framework-4.1.3.jar" src="${getlibs.base}/avalon-framework/jars/avalon-framework-4.1.3.jar"/>
+    <get dest="lib/log4j-1.2.12.jar" src="${getlibs.base}/log4j/jars/log4j-1.2.12.jar"/>
+    <get dest="lib/servletapi-2.3.jar" src="${getlibs.base}/servletapi/jars/servletapi-2.3.jar"/>
+  </target>
+
+  <target name="init"
+   description="Initialize and evaluate conditionals">
+    <echo message="-------- ${component.title} ${component.version} --------"/>
+    <filter  token="name"                  value="${component.name}"/>
+    <filter  token="package"               value="${component.package}"/>
+    <filter  token="version"               value="${component.version}"/>
+  </target>  
+  
+  <target name="prepare" depends="init"
+   description="Prepare build directory">
+
+    <mkdir dir="${build.home}"/>
+    <mkdir dir="${build.home}/classes"/>
+    <mkdir dir="${build.home}/conf"/>
+    <mkdir dir="${build.home}/tests"/>
+  </target>
+
+
+  <target name="static" depends="prepare"
+   description="Copy static files to build directory">
+    <tstamp/>
+    <copy  todir="${build.home}/conf" filtering="on">
+      <fileset dir="${conf.home}" includes="*.MF"/>
+      <fileset dir="${conf.home}" includes="*.properties"/>
+    </copy>
+  </target>
+
+  <target name="compile" depends="static,compile-only"
+          description="Compile shareable components"/>
+
+  <target name="compile-only" 
+    depends="prepare,compile-core,compile-core-static,compile-noop,compile-simple"/>
+
+  <target name="compile-core" depends="prepare">
+  	<mkdir dir="src/core/classes"/>
+    <javac srcdir="src/core/java"
+           destdir="src/core/classes"
+           debug="${compile.debug}"
+           deprecation="${compile.deprecation}"
+           optimize="${compile.optimize}"
+           source="${source.version}"
+           target="${target.version}">
+
+      <classpath refid="compile.classpath"/>
+    </javac>
+  	
+  </target>
+
+  <target name="compile-core-static" depends="prepare,compile-core">
+  	<mkdir dir="src/core-static/classes"/>
+  	<mkdir dir="src/core-static/classes/META-INF"/>
+  	<mkdir dir="src/core-static/classes/META-INF/services"/>
+  	<copy file="src/core-static/conf/org.apache.commons.logging.LogFactory"
+  		todir="src/core-static/classes/META-INF/services"/>
+    <javac srcdir="src/core-static/java"
+           destdir="src/core-static/classes"
+           debug="${compile.debug}"
+           deprecation="${compile.deprecation}"
+           optimize="${compile.optimize}"
+           source="${source.version}"
+           target="${target.version}">
+
+      <classpath refid="compile.classpath"/>
+      <classpath>
+        <pathelement location="src/core/classes"/>
+      </classpath>
+    </javac>
+    <jar jarfile="src/core-static/core-static.jar"
+         manifest="${build.home}/conf/MANIFEST.MF">
+      <fileset dir="src/core-static/classes">
+        <include name="org/apache/commons/logging/**" />
+        <include name="META-INF/**" />
+        <exclude name="**/package.html"/>
+      </fileset>
+      <fileset dir="src/core/classes">
+        <include name="org/apache/commons/logging/**" />
+        <include name="META-INF/LICENSE.txt"/>
+        <include name="META-INF/NOTICE.txt"/>
+        <exclude name="**/package.html"/>
+      </fileset>
+    </jar>
+  	
+  </target>
+
+  <target name="compile-noop" depends="prepare, compile-core">
+  	<mkdir dir="src/noop/classes"/>
+  	<mkdir dir="src/noop/classes/META-INF"/>
+  	<mkdir dir="src/noop/classes/META-INF/services"/>
+  	<copy file="src/noop/conf/org.apache.commons.logging.LogHandler"
+  		todir="src/noop/classes/META-INF/services"/>
+    <javac srcdir="src/noop/java"
+           destdir="src/noop/classes"
+           debug="${compile.debug}"
+           deprecation="${compile.deprecation}"
+           optimize="${compile.optimize}"
+           source="${source.version}"
+           target="${target.version}">
+
+      <classpath refid="compile.classpath"/>
+      <classpath>
+        <pathelement location="src/core/classes"/>
+      </classpath>
+        </javac>
+
+  	<jar jarfile="src/noop/noop.jar"
+         basedir="src/noop/classes"
+         manifest="${build.home}/conf/MANIFEST.MF">
+        <include name="org/apache/commons/logging/**" />
+        <include name="META-INF/**" />
+        <exclude name="**/package.html"/>
+    </jar>
+  	
+  </target>
+
+	  <target name="compile-simple" depends="prepare, compile-core">
+	  	<mkdir dir="src/simple/classes"/>
+	  	<mkdir dir="src/simple/classes/META-INF"/>
+	  	<mkdir dir="src/simple/classes/META-INF/services"/>
+	  	<copy file="src/simple/conf/org.apache.commons.logging.LogHandler"
+	  		todir="src/simple/classes/META-INF/services"/>
+	    <javac srcdir="src/simple/java"
+	           destdir="src/simple/classes"
+	           debug="${compile.debug}"
+	           deprecation="${compile.deprecation}"
+	           optimize="${compile.optimize}"
+	           source="${source.version}"
+	           target="${target.version}">
+
+	      <classpath refid="compile.classpath"/>
+	      <classpath>
+	        <pathelement location="src/core/classes"/>
+	      </classpath>
+	    </javac>
+        <jar jarfile="src/simple/simple.jar"
+             basedir="src/simple/classes"
+             manifest="${build.home}/conf/MANIFEST.MF">
+          <include name="org/apache/commons/logging/**" />
+          <include name="META-INF/**"/>
+          <exclude name="**/package.html"/>
+        </jar>
+	  </target>
+
+  <target name="clean" description="Clean build and distribution directories">
+    <mkdir dir='${build.home}'/>
+    <delete dir="src/core/classes"/>
+    <delete dir="src/core-static/classes"/>
+    <delete file="src/core-static/core-static.jar"/>
+    <delete dir="src/noop/classes"/>
+    <delete file="src/noop/noop.jar"/>
+    <delete dir="src/simple/classes"/>
+    <delete file="src/simple/simple.jar"/>
+  </target>
+
+</project>

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/conf/MANIFEST.MF
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/conf/MANIFEST.MF?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/conf/MANIFEST.MF (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/conf/MANIFEST.MF Wed Mar  1 18:31:39 2006
@@ -0,0 +1,8 @@
+Extension-Name: org.apache.commons.logging
+Specification-Title: Jakarta Commons Logging
+Specification-Vendor: Apache Software Foundation
+Specification-Version: 1.0
+Implementation-Title: Jakarta Commons Logging
+Implementation-Vendor-Id: org.apache
+Implementation-Vendor: Apache Software Foundation
+Implementation-Version: 1.1-RC5

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/conf/org.apache.commons.logging.LogFactory
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/conf/org.apache.commons.logging.LogFactory?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/conf/org.apache.commons.logging.LogFactory (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/conf/org.apache.commons.logging.LogFactory Wed Mar  1 18:31:39 2006
@@ -0,0 +1,3 @@
+# Java services file declaring that LogFactoryStatic provides an implementation
+# of the LogFactory API.
+org.apache.commons.logging.LogFactoryStatic
\ No newline at end of file

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/apache/commons/logging/LogFactoryStatic.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/apache/commons/logging/LogFactoryStatic.java?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/apache/commons/logging/LogFactoryStatic.java (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/apache/commons/logging/LogFactoryStatic.java Wed Mar  1 18:31:39 2006
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2001-2006 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;
+
+
+import java.io.BufferedReader;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Properties;
+
+
+/**
+ * Factory for creating {@link Log} instances.
+ * <p>
+ * This class is intended for use in situations where the classloader
+ * hierarchy is not relevant, eg in standalone applications or in
+ * applets. The Thread Context ClassLoader is not used by this class in
+ * any way.
+ * <p>
+ * There is expected to be one or more "adapter jarfiles" in the classpath.
+ * Each jarfile is expected to contain:
+ * <ul>
+ * <li>An implementation of Log
+ * <li>An implementation of LogHandler
+ * <li>A commons-logging-handler.properties file with a single key named
+ * "handlerClass" that contains the name of the LogHandler implementation
+ * contained in that jarfile.
+ * </ul>
+ * This class takes the first commons-logging-handler.properties file it
+ * finds in the classpath, instantiates the specified LogHandler subclass
+ * then uses that handler object to manufacture all Log objects.
+ */
+
+public final class LogFactoryStatic extends LogFactory {
+
+    private LogHandler handler;
+
+    public LogFactoryStatic() {
+        handler = (LogHandler) Utils.createServiceInstance(LogHandler.class);
+        /*
+        String handlerClassName;
+        try {
+            // Search classpath for the first "commons-logging-handler.properties" file.
+            // Get the "handlerClass" key from it and instantiate the named class.
+            InputStream inputStream = LogFactoryStatic.class.getResourceAsStream(
+                    "/commons-logging-handler.properties");
+            if (inputStream == null) {
+                throw new LogConfigurationException("No logging adapter found.");
+            }
+
+            Properties p = new Properties();
+            p.load(inputStream);
+            inputStream.close();
+            
+            handlerClassName = p.getProperty("handlerClass");
+            if (handlerClassName == null) {
+                throw new LogConfigurationException("Invalid logging adapter configuration.");
+            }
+        } catch(IOException ex) {
+            throw new LogConfigurationException("Internal error while loading logging adapter.");
+        }
+        
+        try {
+            Class clazz = Class.forName(handlerClassName);
+            handler = (LogHandler) clazz.newInstance();
+        } catch(ClassNotFoundException ex) {
+            throw new LogConfigurationException(
+                    "Unable to find handler class '" + handlerClassName + "'");
+        } catch(InstantiationException ex) {
+            throw new LogConfigurationException(
+                    "Unable to instantiate handler class '" + handlerClassName + "'");
+        } catch(IllegalAccessException ex) {
+            throw new LogConfigurationException(
+                    "Unable to instantiate handler class '" + handlerClassName + "'");
+        }
+        */
+    }
+
+    /**
+     * Return a named logger.
+     *
+     * @param clazz Class from which a log name will be derived
+     */
+    public Log getInstance(Class clazz) {
+        return handler.getLog(clazz);
+    }
+
+    /**
+     * @param name Logical name of the <code>Log</code> instance to be
+     *  returned (the meaning of this name is only known to the underlying
+     *  logging implementation that is being wrapped)
+     */
+    public Log getInstance(String name) {
+        return handler.getLog(name);
+    }
+    
+    public void releaseInstance() {
+        handler.release();
+    }
+}

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/apache/commons/logging/LogFactoryStatic.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core-static/java/org/apache/commons/logging/LogFactoryStatic.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Log.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Log.java?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Log.java (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Log.java Wed Mar  1 18:31:39 2006
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2001-2006 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;
+
+/**
+ * A simple logging interface abstracting logging APIs.
+ * <p>
+ * Implementations of this interface are expected to be Serializable.
+ * <p>
+ * The six logging levels used by <code>Log</code> are (in order):
+ * <ol>
+ * <li>trace (the least serious)</li>
+ * <li>debug</li>
+ * <li>info</li>
+ * <li>warn</li>
+ * <li>error</li>
+ * <li>fatal (the most serious)</li>
+ * </ol>
+ * The mapping of these log levels to the concepts used by the underlying
+ * logging system is implementation dependent. The implemention should ensure,
+ * though, that this ordering behaves as expected.
+ * <p>
+ * Performance is often a logging concern. By examining the appropriate
+ * property, a component can avoid expensive operations (producing
+ * information to be logged).
+ * <p>
+ * For example,
+ * <code><pre>
+ *    if (log.isDebugEnabled()) {
+ *        ... do something expensive ...
+ *        log.debug(theResult);
+ *    }
+ * </pre></code>
+ * <p>
+ * Configuration of the underlying logging system will generally be done
+ * external to the Logging APIs, through whatever mechanism is supported by
+ * that system.
+ */
+
+public interface Log {
+
+    // ------------ Guard Methods ------------
+
+    /**
+     * Is trace logging currently enabled?
+     * <p>
+     * Call this method to prevent having to perform expensive operations
+     * (for example, <code>String</code> concatenation) when the log level
+     * is more than trace.
+     *
+     * @return true if trace is enabled in the underlying logger.
+     */
+    public boolean isTraceEnabled();
+
+    /**
+     * Is debug logging currently enabled?
+     * <p>
+     * Call this method to prevent having to perform expensive operations
+     * (for example, <code>String</code> concatenation) when the log level
+     * is more than debug.
+     *
+     * @return true if debug is enabled in the underlying logger.
+     */
+    public boolean isDebugEnabled();
+
+    /**
+     * Is info logging currently enabled?
+     * <p>
+     * Call this method to prevent having to perform expensive operations
+     * (for example, <code>String</code> concatenation) when the log level
+     * is more than info.
+     *
+     * @return true if info is enabled in the underlying logger.
+     */
+    public boolean isInfoEnabled();
+
+    /**
+     * Is warn logging currently enabled?
+     * <p>
+     * Call this method to prevent having to perform expensive operations
+     * (for example, <code>String</code> concatenation) when the log level
+     * is more than warn.
+     *
+     * @return true if warn is enabled in the underlying logger.
+     */
+    public boolean isWarnEnabled();
+
+    /**
+     * Is error logging currently enabled?
+     * <p>
+     * Call this method to prevent having to perform expensive operations
+     * (for example, <code>String</code> concatenation) when the log level
+     * is more than error.
+     *
+     * @return true if error is enabled in the underlying logger.
+     */
+    public boolean isErrorEnabled();
+
+    /**
+     * Is fatal logging currently enabled?
+     * <p>
+     * Call this method to prevent having to perform expensive operations
+     * (for example, <code>String</code> concatenation) when the log level
+     * is more than fatal.
+     *
+     * @return true if fatal is enabled in the underlying logger.
+     */
+    public boolean isFatalEnabled();
+
+    // ------------ Output Methods ------------
+
+    /**
+     * Log a message with trace log level.
+     *
+     * @param message log this message
+     */
+    public void trace(Object message);
+
+    /**
+     * Log a message with trace log level.
+     *
+     * @param message log this message
+     * @param t log this cause
+     */
+    public void trace(Object message, Throwable t);
+
+    /**
+     * Log a message with debug log level.
+     *
+     * @param message log this message
+     */
+    public void debug(Object message);
+
+    /**
+     * Log a message with debug log level.
+     *
+     * @param message log this message
+     * @param t log this cause
+     */
+    public void debug(Object message, Throwable t);
+
+    /**
+     * Log a message with info log level.
+     *
+     * @param message log this message
+     */
+    public void info(Object message);
+
+    /**
+     * Log a message with info log level.
+     *
+     * @param message log this message
+     * @param t log this cause
+     */
+    public void info(Object message, Throwable t);
+
+    /**
+     * Log a message with warn log level.
+     *
+     * @param message log this message
+     */
+    public void warn(Object message);
+
+    /**
+     * Log a message with warn log level.
+     *
+     * @param message log this message
+     * @param t log this cause
+     */
+    public void warn(Object message, Throwable t);
+
+    /**
+     * Log a message with error log level.
+     *
+     * @param message log this message
+     */
+    public void error(Object message);
+
+    /**
+     * Log a message with error log level.
+     *
+     * @param message log this message
+     * @param t log this cause
+     */
+    public void error(Object message, Throwable t);
+
+    /**
+     * Log a message with fatal log level.
+     *
+     * @param message log this message
+     */
+    public void fatal(Object message);
+
+    /**
+     * Log a message with fatal log level.
+     *
+     * @param message log this message
+     * @param t log this cause
+     */
+    public void fatal(Object message, Throwable t);
+}

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Log.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Log.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogConfigurationException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogConfigurationException.java?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogConfigurationException.java (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogConfigurationException.java Wed Mar  1 18:31:39 2006
@@ -0,0 +1,97 @@
+/*
+ * 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;
+
+
+/**
+ * <p>An exception that is thrown only if a suitable <code>LogFactory</code>
+ * or <code>Log</code> instance cannot be created by the corresponding
+ * factory methods.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public class LogConfigurationException extends RuntimeException {
+
+
+    /**
+     * Construct a new exception with <code>null</code> as its detail message.
+     */
+    public LogConfigurationException() {
+
+        super();
+
+    }
+
+
+    /**
+     * Construct a new exception with the specified detail message.
+     *
+     * @param message The detail message
+     */
+    public LogConfigurationException(String message) {
+
+        super(message);
+
+    }
+
+
+    /**
+     * Construct a new exception with the specified cause and a derived
+     * detail message.
+     *
+     * @param cause The underlying cause
+     */
+    public LogConfigurationException(Throwable cause) {
+
+        this((cause == null) ? null : cause.toString(), cause);
+
+    }
+
+
+    /**
+     * Construct a new exception with the specified detail message and cause.
+     *
+     * @param message The detail message
+     * @param cause The underlying cause
+     */
+    public LogConfigurationException(String message, Throwable cause) {
+
+        super(message + " (Caused by " + cause + ")");
+        this.cause = cause; // Two-argument version requires JDK 1.4 or later
+
+    }
+
+
+    /**
+     * The underlying cause of this exception.
+     */
+    protected Throwable cause = null;
+
+
+    /**
+     * Return the underlying cause of this exception (if any).
+     */
+    public Throwable getCause() {
+
+        return (this.cause);
+
+    }
+
+
+}

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogConfigurationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogConfigurationException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogFactory.java?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogFactory.java (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogFactory.java Wed Mar  1 18:31:39 2006
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2001-2006 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;
+
+/**
+ * Factory for creating {@link Log} instances.
+ * <p>
+ * This is a very simple class that uses the standard Java service discovery
+ * mechanism to locate the *real* implementation to use. See {@link
+ * http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider}.
+ * <p>
+ * Note that a concrete LogFactory implementation must always be deployed
+ * together with a copy of the LogFactory class and the necessary service file
+ * to bind the two together; as long as that happens the classes will effectively
+ * behave as if they are one single class. Deploying a LogFactory without an
+ * implementation, or a LogFactory subclass without its parent can lead to
+ * nasty classpath-related issues when complex classloader hierarchies are
+ * present.
+ */
+
+public abstract class LogFactory {
+
+    private static final LogFactory instance = discoverInstance();
+    
+    /**
+     * Each jarfile that contains this class is also expected to contain:
+     * <ul>
+     * <li>A concrete subclass of this class, and
+     * <li>A META-INF/services/org.apache.commons.logging.LogFactory file. 
+     * </ul>
+     * The file contains a single non-comment line containing the name of
+     * the concrete class. An instance of that type will be created, and
+     * all methods on this class then simply delegate to that instance.
+     */
+    private static LogFactory discoverInstance() {
+        return (LogFactory) Utils.createServiceInstance(LogFactory.class);
+    }
+
+    /**
+     * Return a named logger.
+     *
+     * @param clazz Class from which a log name will be derived
+     */
+    public static Log getLog(Class clazz) {
+        return instance.getInstance(clazz);
+    }
+
+    /**
+     * Return a named logger.
+     *
+     * @param name Logical name of the <code>Log</code> instance to be
+     *  returned (the meaning of this name is only known to the underlying
+     *  logging implementation that is being wrapped)
+     */
+    public static Log getLog(String name) {
+        return instance.getInstance(name);
+    }
+
+    /**
+     * Release any resources held by commons-logging or by the underlying 
+     * concrete library.
+     */
+    public static void release() {
+        instance.release();
+    }
+    
+    /**
+     * Get an instance of Log whose category matches the specified class.
+     * <p>
+     * This method would perhaps be better named "getLog", but that name
+     * is already taken by the static method on this class.
+     */
+    protected abstract Log getInstance(Class clazz);
+
+    /**
+     * Get an instance of Log whose category matches the specified string.
+     * <p>
+     * This method would perhaps be better named "getLog", but that name
+     * is already taken by the static method on this class.
+     */
+    protected abstract Log getInstance(String category);
+
+    /**
+     * Release all resources. 
+     * <p>
+     * This method would perhaps be better named "release", but that name
+     * is already taken by the static method on this class.
+     */
+    protected abstract void releaseInstance();
+}

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogFactory.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogHandler.java?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogHandler.java (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogHandler.java Wed Mar  1 18:31:39 2006
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2006 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;
+
+/**
+ * An interface for manufacturing Log objects.
+ * <p>
+ * Implementations of this interface are expected to be Serializable.
+ */
+
+public interface LogHandler {
+    public Log getLog(Class clazz);
+    public Log getLog(String category);
+    public void release();
+}

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/LogHandler.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Utils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Utils.java?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Utils.java (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Utils.java Wed Mar  1 18:31:39 2006
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2006 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;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
+
+/**
+ * Utility methods used by other logging classes. This class contains
+ * only static utility methods and shouldn't be instantiated.
+ */
+
+public final class Utils {
+
+    /**
+     * This class contains only static utils and shouldn't be instantiated.
+     */
+    private Utils() {
+    }
+
+    /**
+     * Each jarfile that contains this class is also expected to contain:
+     * <ul>
+     * <li>A concrete subclass of this class, and
+     * <li>A META-INF/services/org.apache.commons.logging.LogFactory file. 
+     * </ul>
+     * The file contains a single non-comment line containing the name of
+     * the concrete class. An instance of that type will be created, and
+     * all methods on this class then simply delegate to that instance.
+     */
+    public static Object createServiceInstance(Class baseClass) 
+    throws LogConfigurationException {
+
+        String serviceName = baseClass.getName();
+        String serviceFileName = "/META-INF/services/" + serviceName;
+        InputStream is = baseClass.getResourceAsStream(serviceFileName);
+        
+        if (is == null) {
+            throw new LogConfigurationException(
+                "Service '" + serviceName + "'"
+                + " has no service file '" + serviceFileName + "'"); 
+        }
+        
+        String serviceClassName;
+        try {
+            serviceClassName = readServiceClassName(is);
+            is.close();
+        } catch(IOException ex) {
+            throw new LogConfigurationException(
+                "Unable to read configuration for service '" + serviceName + "'"
+                + " from file '" + serviceFileName + "'");
+        }
+
+        if (serviceClassName == null) {
+            throw new LogConfigurationException(
+                "Service file '" + serviceFileName + "' contains no classname");
+        }
+        
+        try {
+            Class serviceClass = Class.forName(serviceClassName);
+            if (!(baseClass.isAssignableFrom(serviceClass))) {
+                throw new LogConfigurationException(
+                    "Class '" + serviceClassName + "' does not implement "
+                    + "'" + serviceName + "'");
+            }
+            return serviceClass.newInstance();
+        } catch(ClassNotFoundException ex) {
+            throw new LogConfigurationException(
+                    "Service provider not found:" + serviceClassName);
+        } catch(InstantiationException ex) {
+            throw new LogConfigurationException(
+                    "Service provider could not be instantiated:" + serviceClassName);
+        } catch(IllegalAccessException ex) {
+            throw new LogConfigurationException(
+                    "Service provider could not be instantiated:" + serviceClassName);
+        }
+    }
+    
+    private static String readServiceClassName(InputStream is) throws IOException {
+        InputStreamReader isr = new InputStreamReader(is);
+        BufferedReader reader = new BufferedReader(isr);
+        for(;;) {
+            String s = reader.readLine();
+            if (s == null)
+                return null;
+            s.trim();
+            if (!s.startsWith("#")) {
+                return s;
+            }
+        }
+    }
+}

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Utils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/core/java/org/apache/commons/logging/Utils.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/conf/org.apache.commons.logging.LogHandler
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/conf/org.apache.commons.logging.LogHandler?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/conf/org.apache.commons.logging.LogHandler (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/conf/org.apache.commons.logging.LogHandler Wed Mar  1 18:31:39 2006
@@ -0,0 +1 @@
+org.apache.commons.logging.noop.NoOpLogHandler

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLog.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLog.java?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLog.java (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLog.java Wed Mar  1 18:31:39 2006
@@ -0,0 +1,105 @@
+/*
+ * 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.noop;
+
+import java.io.Serializable;
+import org.apache.commons.logging.Log;
+
+/**
+ * Trivial implementation of Log that throws away all messages.
+ */
+public class NoOpLog implements Log, Serializable {
+
+    /** Do nothing */
+    public void trace(Object message) { }
+
+    /** Do nothing */
+    public void trace(Object message, Throwable t) { }
+
+    /** Do nothing */
+    public void debug(Object message) { }
+
+    /** Do nothing */
+    public void debug(Object message, Throwable t) { }
+
+    /** Do nothing */
+    public void info(Object message) { }
+
+    /** Do nothing */
+    public void info(Object message, Throwable t) { }
+
+    /** Do nothing */
+    public void warn(Object message) { }
+
+    /** Do nothing */
+    public void warn(Object message, Throwable t) { }
+
+    /** Do nothing */
+    public void error(Object message) { }
+
+    /** Do nothing */
+    public void error(Object message, Throwable t) { }
+
+    /** Do nothing */
+    public void fatal(Object message) { }
+
+    /** Do nothing */
+    public void fatal(Object message, Throwable t) { }
+
+    /**
+     * Trace is never enabled.
+     *
+     * @return false
+     */
+    public final boolean isTraceEnabled() { return false; }
+
+    /**
+     * Debug is never enabled.
+     *
+     * @return false
+     */
+    public final boolean isDebugEnabled() { return false; }
+
+    /**
+     * Info is never enabled.
+     *
+     * @return false
+     */
+    public final boolean isInfoEnabled() { return false; }
+
+    /**
+     * Warn is never enabled.
+     *
+     * @return false
+     */
+    public final boolean isWarnEnabled() { return false; }
+
+    /**
+     * Error is never enabled.
+     *
+     * @return false
+     */
+    public final boolean isErrorEnabled() { return false; }
+
+    /**
+     * Fatal is never enabled.
+     *
+     * @return false
+     */
+    public final boolean isFatalEnabled() { return false; }
+}

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLog.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java Wed Mar  1 18:31:39 2006
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2006 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.noop;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogHandler;
+
+/**
+ * Manufactures NoOpLog instances.
+ * <p>
+ * Actually, only one NoOpLog instance ever exists, as each
+ * instance would be identical to all other instances.
+ */
+
+public final class NoOpLogHandler implements LogHandler {
+    private NoOpLog instance = new NoOpLog();
+
+    public Log getLog(Class clazz) {
+        return instance;
+    }
+
+    public Log getLog(String category) {
+        return instance;
+    }
+
+    public void release() {
+    }
+}
\ No newline at end of file

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/noop/java/org/apache/commons/logging/noop/NoOpLogHandler.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/conf/org.apache.commons.logging.LogHandler
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/conf/org.apache.commons.logging.LogHandler?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/conf/org.apache.commons.logging.LogHandler (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/conf/org.apache.commons.logging.LogHandler Wed Mar  1 18:31:39 2006
@@ -0,0 +1 @@
+org.apache.commons.logging.simple.SimpleLogHandler

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLog.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLog.java?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLog.java (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLog.java Wed Mar  1 18:31:39 2006
@@ -0,0 +1,345 @@
+/*
+ * 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.simple;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.DateFormat;
+
+import org.apache.commons.logging.Log;
+
+/**
+ * Trivial implementation of Log that throws away all messages.
+ */
+public final class SimpleLog implements Log, Serializable {
+
+    // ------------------------------------------------------------- Attributes
+
+    /** The name of this simple log instance */
+    protected String category = null;
+
+    /** The current log level */
+    protected int threshold;
+
+    /** The name to display as the source of messages; typically same as logCategory.*/
+    private String displayName = null;
+    
+    private DateFormat dateFormatter = null;
+
+    // ------------------------------------------------------------- Constructor
+
+    /**
+     * Construct a simple log with given name.
+     *
+     * @param name log name
+     */
+    public SimpleLog(String category, int threshold, String displayName, 
+            DateFormat dateFormatter) {
+
+        this.category = category;
+        this.threshold = threshold;
+        this.displayName = displayName;
+        this.dateFormatter = dateFormatter;
+    }
+
+    /**
+     * Do the actual logging.
+     *
+     * @param level One of the LOG_LEVEL_XXX constants defining the log level
+     * @param message The message itself (typically a String)
+     * @param t The exception whose stack trace should be logged
+     */
+    private void log(int level, Object message, Throwable t) {
+        // Use a string buffer for better performance
+        StringBuffer buf = new StringBuffer();
+
+        // Append date-time if so configured
+        if(dateFormatter != null) {
+            buf.append(dateFormatter.format(new Date()));
+            buf.append(" ");
+        }
+
+        // Append level of the current message
+        switch(level) {
+            case SimpleLogHandler.LOG_LEVEL_TRACE: buf.append("[TRACE] "); break;
+            case SimpleLogHandler.LOG_LEVEL_DEBUG: buf.append("[DEBUG] "); break;
+            case SimpleLogHandler.LOG_LEVEL_INFO:  buf.append("[INFO] ");  break;
+            case SimpleLogHandler.LOG_LEVEL_WARN:  buf.append("[WARN] ");  break;
+            case SimpleLogHandler.LOG_LEVEL_ERROR: buf.append("[ERROR] "); break;
+            case SimpleLogHandler.LOG_LEVEL_FATAL: buf.append("[FATAL] "); break;
+        }
+
+        // Append the name of the log instance if so configured
+        if (displayName != null) {
+            buf.append(displayName);
+            buf.append(" - ");
+        }
+
+        // Append the message
+        buf.append(String.valueOf(message));
+
+        // Append stack trace if not null
+        if(t != null) {
+            buf.append(" <");
+            buf.append(t.toString());
+            buf.append(">");
+
+            java.io.StringWriter sw= new java.io.StringWriter(1024);
+            java.io.PrintWriter pw= new java.io.PrintWriter(sw);
+            t.printStackTrace(pw);
+            pw.close();
+            buf.append(sw.toString());
+        }
+
+        // Print to the appropriate destination
+        System.err.println(buf.toString());
+    }
+
+    /**
+     * Is the given log level currently enabled?
+     *
+     * @param logLevel is this level enabled?
+     */
+    private boolean isLevelEnabled(int logLevel) {
+        // log levels are numerically ordered so can use simple numeric
+        // comparison
+        return (logLevel >= threshold);
+    }
+
+
+    // -------------------------------------------------------- Log Implementation
+
+    /**
+     * Logs a message with level trace. 
+     *
+     * @param message to log
+     * @see org.apache.commons.logging.Log#trace(Object, Throwable)
+     */
+    public final void trace(Object message) {
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_TRACE)) {
+            log(SimpleLogHandler.LOG_LEVEL_TRACE, message, null);
+        }
+    }
+
+    /**
+     * Logs a message with level trace. 
+     *
+     * @param message to log
+     * @param t log this cause
+     * @see org.apache.commons.logging.Log#trace(Object, Throwable)
+     */
+    public final void trace(Object message, Throwable t) {
+
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_TRACE)) {
+            log(SimpleLogHandler.LOG_LEVEL_TRACE, message, t);
+        }
+    }
+
+    /**
+     * Logs a message with level debug.
+     *
+     * @param message to log
+     * @see org.apache.commons.logging.Log#debug(Object)
+     */
+    public final void debug(Object message) {
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_DEBUG)) {
+            log(SimpleLogHandler.LOG_LEVEL_DEBUG, message, null);
+        }
+    }
+
+    /**
+     * Logs a message with level debug. 
+     *
+     * @param message to log
+     * @param t log this cause
+     * @see org.apache.commons.logging.Log#debug(Object, Throwable)
+     */
+    public final void debug(Object message, Throwable t) {
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_DEBUG)) {
+            log(SimpleLogHandler.LOG_LEVEL_DEBUG, message, t);
+        }
+    }
+
+    /**
+     * Logs a message with level info. 
+     *
+     * @param message to log
+     * @see org.apache.commons.logging.Log#info(Object)
+     */
+    public final void info(Object message) {
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_INFO)) {
+            log(SimpleLogHandler.LOG_LEVEL_INFO,message,null);
+        }
+    }
+
+    /**
+     * Logs a message with level info. 
+     *
+     * @param message to log
+     * @param t log this cause
+     * @see org.apache.commons.logging.Log#info(Object, Throwable)
+     */
+    public final void info(Object message, Throwable t) {
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_INFO)) {
+            log(SimpleLogHandler.LOG_LEVEL_INFO, message, t);
+        }
+    }
+
+    /**
+     * Logs a message with level warn. 
+     *
+     * @param message to log
+     * @see org.apache.commons.logging.Log#warn(Object)
+     */
+    public final void warn(Object message) {
+
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_WARN)) {
+            log(SimpleLogHandler.LOG_LEVEL_WARN, message, null);
+        }
+    }
+
+    /**
+     * Logs a message with level warn. 
+     *
+     * @param message to log
+     * @param t log this cause
+     * @see org.apache.commons.logging.Log#warn(Object, Throwable)
+     */
+    public final void warn(Object message, Throwable t) {
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_WARN)) {
+            log(SimpleLogHandler.LOG_LEVEL_WARN, message, t);
+        }
+    }
+
+    /**
+     * Logs a message with level error. 
+     *
+     * @param message to log
+     * @see org.apache.commons.logging.Log#error(Object)
+     */
+    public final void error(Object message) {
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_ERROR)) {
+            log(SimpleLogHandler.LOG_LEVEL_ERROR, message, null);
+        }
+    }
+
+    /**
+     * Logs a message with level error. 
+     *
+     * @param message to log
+     * @param t log this cause
+     * @see org.apache.commons.logging.Log#error(Object, Throwable)
+     */
+    public final void error(Object message, Throwable t) {
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_ERROR)) {
+            log(SimpleLogHandler.LOG_LEVEL_ERROR, message, t);
+        }
+    }
+
+    /**
+     * Log a message with level fatal. 
+     *
+     * @param message to log
+     * @see org.apache.commons.logging.Log#fatal(Object)
+     */
+    public final void fatal(Object message) {
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_FATAL)) {
+            log(SimpleLogHandler.LOG_LEVEL_FATAL, message, null);
+        }
+    }
+
+    /**
+     * Logs a message with level fatal. 
+     *
+     * @param message to log
+     * @param t log this cause
+     * @see org.apache.commons.logging.Log#fatal(Object, Throwable)
+     */
+    public final void fatal(Object message, Throwable t) {
+        if (isLevelEnabled(SimpleLogHandler.LOG_LEVEL_FATAL)) {
+            log(SimpleLogHandler.LOG_LEVEL_FATAL, message, t);
+        }
+    }
+
+    /**
+     * Are trace messages currently enabled?
+     * <p>
+     * This allows expensive operations such as <code>String</code>
+     * concatenation to be avoided when the message will be ignored by the
+     * logger.
+     */
+    public final boolean isTraceEnabled() {
+        return isLevelEnabled(SimpleLogHandler.LOG_LEVEL_TRACE);
+    }
+
+    /**
+     * Are debug messages currently enabled?
+     * <p>
+     * This allows expensive operations such as <code>String</code>
+     * concatenation to be avoided when the message will be ignored by the
+     * logger.
+     */
+    public final boolean isDebugEnabled() {
+        return isLevelEnabled(SimpleLogHandler.LOG_LEVEL_DEBUG);
+    }
+
+    /**
+     * Are info messages currently enabled?
+     * <p>
+     * This allows expensive operations such as <code>String</code>
+     * concatenation to be avoided when the message will be ignored by the
+     * logger.
+     */
+    public final boolean isInfoEnabled() {
+        return isLevelEnabled(SimpleLogHandler.LOG_LEVEL_INFO);
+    }
+
+    /**
+     * Are warn messages currently enabled?
+     * <p>
+     * This allows expensive operations such as <code>String</code>
+     * concatenation to be avoided when the message will be ignored by the
+     * logger.
+     */
+    public final boolean isWarnEnabled() {
+        return isLevelEnabled(SimpleLogHandler.LOG_LEVEL_WARN);
+    }
+
+
+    /**
+     * Are error messages currently enabled?
+     * <p>
+     * This allows expensive operations such as <code>String</code>
+     * concatenation to be avoided when the message will be ignored by the
+     * logger.
+     */
+    public final boolean isErrorEnabled() {
+        return isLevelEnabled(SimpleLogHandler.LOG_LEVEL_ERROR);
+    }
+
+    /**
+     * Are fatal messages currently enabled?
+     * <p>
+     * This allows expensive operations such as <code>String</code>
+     * concatenation to be avoided when the message will be ignored by the
+     * logger.
+     */
+    public final boolean isFatalEnabled() {
+        return isLevelEnabled(SimpleLogHandler.LOG_LEVEL_FATAL);
+    }
+}

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLog.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLogHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLogHandler.java?rev=382246&view=auto
==============================================================================
--- jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLogHandler.java (added)
+++ jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLogHandler.java Wed Mar  1 18:31:39 2006
@@ -0,0 +1,283 @@
+/*
+ * Copyright 2006 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.simple;
+
+import java.io.InputStream;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Properties;
+import java.util.Hashtable;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogHandler;
+
+/**
+ * Manufactures SimpleLog instances.
+ * <p>
+ * Output for all enabled log messages goes to System.err.
+ * The following system properties are supported to configure the behavior
+ * of this logger:
+ * <ul>
+ * <li><code>org.apache.commons.logging.simplelog.defaultlog</code> -
+ *     Default logging detail level for all instances of SimpleLog.
+ *     Must be one of ("trace", "debug", "info", "warn", "error", or "fatal").
+ *     If not specified, defaults to "info". </li>
+ * <li><code>org.apache.commons.logging.simplelog.log.xxxxx</code> -
+ *     Logging detail level for a SimpleLog instance named "xxxxx".
+ *     Must be one of ("trace", "debug", "info", "warn", "error", or "fatal").
+ *     If not specified, the default logging detail level is used.</li>
+ * <li><code>org.apache.commons.logging.simplelog.showlogname</code> -
+ *     Set to <code>true</code> if you want the Log instance name to be
+ *     included in output messages. Defaults to <code>false</code>.</li>
+ * <li><code>org.apache.commons.logging.simplelog.showShortLogname</code> -
+ *     Set to <code>true</code> if you want the last component of the name to be
+ *     included in output messages. Defaults to <code>true</code>.</li>
+ * <li><code>org.apache.commons.logging.simplelog.showdatetime</code> -
+ *     Set to <code>true</code> if you want the current date and time
+ *     to be included in output messages. Default is <code>false</code>.</li>
+ * <li><code>org.apache.commons.logging.simplelog.dateTimeFormat</code> -
+ *     The date and time format to be used in the output messages.
+ *     The pattern describing the date and time format is the same that is
+ *     used in <code>java.text.SimpleDateFormat</code>. If the format is not
+ *     specified or is invalid, the default format is used.
+ *     The default format is <code>yyyy/MM/dd HH:mm:ss:SSS zzz</code>.</li>
+ * </ul>
+ * <p>
+ * In addition to looking for system properties with the names specified
+ * above, this implementation also checks for a class loader resource named
+ * <code>"simplelog.properties"</code>, and includes any matching definitions
+ * from this resource (if it exists).
+ */
+
+public final class SimpleLogHandler implements LogHandler {
+    
+    /*
+     * Log level constants; package-scope so SimpleLog can use them.
+     */
+
+    static final int LOG_LEVEL_TRACE  = 1;
+    static final int LOG_LEVEL_DEBUG  = 2;
+    static final int LOG_LEVEL_INFO   = 3;
+    static final int LOG_LEVEL_WARN   = 4;
+    static final int LOG_LEVEL_ERROR  = 5;
+    static final int LOG_LEVEL_FATAL  = 6;
+    static final int LOG_LEVEL_ALL    = (LOG_LEVEL_TRACE - 1);
+    static final int LOG_LEVEL_OFF    = (LOG_LEVEL_FATAL + 1);
+
+    // ----------- Static members ----------------------------
+
+    /** All system properties used by <code>SimpleLog</code> start with this */
+    static private final String systemPrefix =
+        "org.apache.commons.logging.simplelog.";
+
+    /** The default format to use when formating dates */
+    static protected final String DEFAULT_DATE_TIME_FORMAT =
+        "yyyy/MM/dd HH:mm:ss:SSS zzz";
+
+    // ----------- Instance members ----------------------------
+
+    /**
+     * Map of category->SimpleLog for all categories we've seen so far.
+     * <p>
+     * Note that Hashtable is used instead of Map because we want this class
+     * to be usable on 1.1 JVMs. It does unfortunately impose a performance
+     * hit, because it is internally synchronized.
+     */
+    private Hashtable logs;
+
+    /**
+     * The configuration file (if any) loaded. We need to keep this around,
+     * as it must be consulted each time a new SimpleLog is created; the
+     * settings may be different for each category.
+     */
+    private Properties simpleLogProps;
+
+    /** Include the instance name in the log message? */
+    private boolean showLogName = false;
+
+    /** Include the short name ( last component ) of the logger in the log
+     *  message? Defaults to true - otherwise we'll be lost in a flood of
+     *  messages without knowing who sends them.
+     */
+    private boolean showShortName = true;
+
+    /** Include the current time in the log message? */
+    private boolean showDateTime = false;
+
+    /** The date and time format to use in the log message */
+    private String dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
+
+    /** Used to format times */
+    private DateFormat dateFormatter = null;
+
+    // ----------- Public methods ----------------------------
+
+    public Log getLog(Class clazz) {
+        return getLog(clazz.getName());
+    }
+
+    public synchronized Log getLog(String category) {
+        if (logs == null)
+            init();
+
+        Log log = (Log) logs.get(category);
+        if (log == null) {
+            log = makeLog(category);
+            logs.put(category, log);
+        }
+        return log;
+    }
+
+    /**
+     * Release all resources held by the simple logging facility.
+     */
+    public synchronized void release() {
+        logs = null;
+    }
+    
+    // ----------- Private methods ----------------------------
+
+    private void init() {
+        logs = new Hashtable();
+        
+        simpleLogProps = new Properties();
+
+        // Note that the classloader that loaded this class is being used
+        // here, NOT the TCCL. That means that when this class is deployed in
+        // a container's shared classpath it won't configure itself from a
+        // file in the current webapp's path. This is considered ok; the
+        // jarfile containing this class just needs to be deployed at the
+        // webapp level to resolve that. Using the TCCL here would introduce
+        // significant complexity that is not desirable in most cases.
+        InputStream in = SimpleLogHandler.class.getResourceAsStream("simplelog.properties");
+        if(null != in) {
+            try {
+                simpleLogProps.load(in);
+                in.close();
+            } catch(java.io.IOException e) {
+                // ignored
+            }
+        }
+
+        showLogName = getBooleanProperty( systemPrefix + "showlogname", simpleLogProps, showLogName);
+        showShortName = getBooleanProperty( systemPrefix + "showShortLogname", simpleLogProps, showShortName);
+        showDateTime = getBooleanProperty( systemPrefix + "showdatetime", simpleLogProps, showDateTime);
+
+        if(showDateTime) {
+            dateTimeFormat = getStringProperty(systemPrefix + "dateTimeFormat",
+                    simpleLogProps, dateTimeFormat);
+            try {
+                dateFormatter = new SimpleDateFormat(dateTimeFormat);
+            } catch(IllegalArgumentException e) {
+                // If the format pattern is invalid - use the default format
+                dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
+                dateFormatter = new SimpleDateFormat(dateTimeFormat);
+            }
+        }
+    }
+    
+    private Log makeLog(String category) {
+        // set default value if nothing matches
+        int threshold = LOG_LEVEL_INFO;
+
+        // Set log level from properties; check the properties with the full
+        // category name then keep on stripping off components until a match
+        // is found.
+        String name = category;
+        String lvl = getStringProperty(systemPrefix + "log." + name, simpleLogProps);
+        int i = String.valueOf(name).lastIndexOf(".");
+        while(null == lvl && i > -1) {
+            name = name.substring(0,i);
+            lvl = getStringProperty(systemPrefix + "log." + name, simpleLogProps);
+            i = String.valueOf(name).lastIndexOf(".");
+        }
+
+        if(null == lvl) {
+            lvl =  getStringProperty(systemPrefix + "defaultlog", simpleLogProps);
+        }
+
+        if("all".equalsIgnoreCase(lvl)) {
+            threshold = LOG_LEVEL_ALL;
+        } else if("trace".equalsIgnoreCase(lvl)) {
+            threshold = LOG_LEVEL_TRACE;
+        } else if("debug".equalsIgnoreCase(lvl)) {
+            threshold = LOG_LEVEL_DEBUG;
+        } else if("info".equalsIgnoreCase(lvl)) {
+            threshold = LOG_LEVEL_INFO;
+        } else if("warn".equalsIgnoreCase(lvl)) {
+            threshold = LOG_LEVEL_WARN;
+        } else if("error".equalsIgnoreCase(lvl)) {
+            threshold = LOG_LEVEL_ERROR;
+        } else if("fatal".equalsIgnoreCase(lvl)) {
+            threshold = LOG_LEVEL_FATAL;
+        } else if("off".equalsIgnoreCase(lvl)) {
+            threshold = LOG_LEVEL_OFF;
+        }
+
+        // The string to display in the generated message as the "source"
+        // of the message.
+        String displayName;
+        if (showShortName) {
+            // Cut all but the last component of the category name for both styles
+            // of category (dot-separated and slash-separated).
+            displayName = category.substring(category.lastIndexOf(".") + 1);
+            displayName = displayName.substring(displayName.lastIndexOf("/") + 1);
+        } else if(showLogName) {
+            displayName = category;
+        } else {
+            displayName = null;
+        }
+
+        return new SimpleLog(category, threshold, displayName, dateFormatter);
+    }
+
+    /**
+     * Get system property with the specified name. If not found, return the
+     * property of the same name from the provided properties object.
+     */
+    private static String getStringProperty(String name, Properties dfltProps) {
+        String prop = null;
+        try {
+            prop = System.getProperty(name);
+        } catch (SecurityException e) {
+            ; // Ignore
+        }
+        return (prop == null) ? dfltProps.getProperty(name) : prop;
+    }
+
+    /**
+     * Get system property with the specified name. If not found, return the
+     * provided default value.
+     */
+    private static String getStringProperty(String name, Properties dfltProps, String dflt) {
+        String prop = getStringProperty(name, dfltProps);
+        return (prop == null) ? dflt : prop;
+    }
+
+    /**
+     * Get system property with the specified name. If not found, return the
+     * provided default value.
+     */
+    private static boolean getBooleanProperty(String name, Properties dfltProps, boolean dflt) {
+        String prop = getStringProperty(name, dfltProps);
+        return (prop == null) ? dflt : "true".equalsIgnoreCase(prop);
+    }
+
+    // ------------------------------------------------------------ Constructor
+
+}
\ No newline at end of file

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLogHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/logging/contrib/simon/jcl2/src/simple/java/org/apache/commons/logging/simple/SimpleLogHandler.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



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