You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gd...@apache.org on 2005/10/15 09:39:09 UTC
svn commit: r321305 - in /geronimo/trunk/modules:
jetty/src/java/org/apache/geronimo/jetty/ kernel/ kernel/src/META-INF/
kernel/src/META-INF/services/ kernel/src/java/org/apache/geronimo/kernel/log/
tomcat/src/java/org/apache/geronimo/tomcat/
Author: gdamour
Date: Sat Oct 15 00:38:57 2005
New Revision: 321305
URL: http://svn.apache.org/viewcvs?rev=321305&view=rev
Log:
GERONIMO-1074 GeronimoLogFactory should be installed via the service provider
mechanism
Install GeronimoLogFactory via the service provider mechanism. One of the
benefits is to allow Web modules to:
* provide their own commons-logging package; and
* reverse the standard class loading delegation model
without receiving ClassCastException.
Added:
geronimo/trunk/modules/kernel/maven.xml
geronimo/trunk/modules/kernel/src/META-INF/
geronimo/trunk/modules/kernel/src/META-INF/services/
geronimo/trunk/modules/kernel/src/META-INF/services/org.apache.commons.logging.LogFactory
Modified:
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyClassLoader.java
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/log/GeronimoLogging.java
geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatClassLoader.java
Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyClassLoader.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyClassLoader.java?rev=321305&r1=321304&r2=321305&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyClassLoader.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyClassLoader.java Sat Oct 15 00:38:57 2005
@@ -53,7 +53,6 @@
name.startsWith("java.") ||
name.startsWith("javax.") ||
name.startsWith("org.apache.geronimo.") ||
- name.startsWith("org.apache.commons.logging.") ||
name.startsWith("org.mortbay.") ||
name.startsWith("org.xml.") ||
name.startsWith("org.w3c.")) {
Added: geronimo/trunk/modules/kernel/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/maven.xml?rev=321305&view=auto
==============================================================================
--- geronimo/trunk/modules/kernel/maven.xml (added)
+++ geronimo/trunk/modules/kernel/maven.xml Sat Oct 15 00:38:57 2005
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright 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.
+-->
+
+
+<!-- $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ -->
+
+<project default="default"
+ xmlns:j="jelly:core"
+ xmlns:ant="jelly:ant"
+ xmlns:maven="jelly:maven"
+ xmlns:xmlbeans="xmlbeans2:maven">
+
+ <preGoal name="jar:jar">
+ <copy todir="${maven.build.dest}/META-INF">
+ <ant:fileset dir="${basedir}/src/META-INF"/>
+ </copy>
+ </preGoal>
+</project>
Added: geronimo/trunk/modules/kernel/src/META-INF/services/org.apache.commons.logging.LogFactory
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/META-INF/services/org.apache.commons.logging.LogFactory?rev=321305&view=auto
==============================================================================
--- geronimo/trunk/modules/kernel/src/META-INF/services/org.apache.commons.logging.LogFactory (added)
+++ geronimo/trunk/modules/kernel/src/META-INF/services/org.apache.commons.logging.LogFactory Sat Oct 15 00:38:57 2005
@@ -0,0 +1 @@
+org.apache.geronimo.kernel.log.GeronimoLogFactory
\ No newline at end of file
Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/log/GeronimoLogging.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/log/GeronimoLogging.java?rev=321305&r1=321304&r2=321305&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/log/GeronimoLogging.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/log/GeronimoLogging.java Sat Oct 15 00:38:57 2005
@@ -17,6 +17,8 @@
package org.apache.geronimo.kernel.log;
+import java.lang.reflect.Method;
+
import org.apache.commons.logging.LogFactory;
/**
@@ -45,15 +47,23 @@
defaultLevel = level;
consoleLogLevel = level;
- // force commons-logging to use our log factory
- System.setProperty(LogFactory.FACTORY_PROPERTY, GeronimoLogFactory.class.getName());
-
// force the log factory to initialize
LogFactory.getLog(GeronimoLogging.class);
// force mx4j to use commons logging
- // todo do this with reflection so mx4j is not required (this is important in JDK 1.5)
- mx4j.log.Log.redirectTo(new mx4j.log.CommonsLogger());
+ // Use reflection so mx4j is not required (this is important in JDK 1.5)
+ // mx4j.log.Log.redirectTo(new mx4j.log.CommonsLogger());
+ try {
+ Class clazz = Class.forName("mx4j.log.Log");
+ Class paramClazz = Class.forName("mx4j.log.Logger");
+ Method method = clazz.getDeclaredMethod("redirectTo", new Class[] {paramClazz});
+ paramClazz = Class.forName("mx4j.log.CommonsLogger");
+ method.invoke(null, new Object[] {paramClazz.newInstance()});
+ } catch (ClassNotFoundException e) {
+ // MX4J is not present.
+ } catch (Exception e) {
+ throw (AssertionError) new AssertionError("Cannot force MX4J to use commons logging.").initCause(e);
+ }
initialized = true;
}
Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatClassLoader.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatClassLoader.java?rev=321305&r1=321304&r2=321305&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatClassLoader.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatClassLoader.java Sat Oct 15 00:38:57 2005
@@ -57,7 +57,6 @@
name.startsWith("org.apache.tomcat.") ||
name.startsWith("org.apache.naming.") ||
name.startsWith("org.apache.catalina.") ||
- name.startsWith("org.apache.commons.logging.") ||
name.startsWith("org.xml.") ||
name.startsWith("org.w3c.")) {
return super.loadClass(name);