commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [LOGGING] ClassLoader Problems
Date Mon, 22 Apr 2002 17:12:25 GMT


On Mon, 22 Apr 2002, Scott Sanders wrote:

> Date: Mon, 22 Apr 2002 09:48:54 -0700
> From: Scott Sanders <ssanders@nextance.com>
> Reply-To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> Subject: [LOGGING] ClassLoader Problems
>
> Hi all,
>
> I am working on vindico, a replacement for Alexandria over in the
> Alexandria CVS, and I am using commons-digester, which in turn uses
> commons-logging.
>
> When running Vindico as an Ant task,  it starts running and then says
> that it cannot find the LogFactoryImpl class.
>
> I have traced this down to the getClassLoader() function in LogFactory,
> which returns the Thread.getContextClassLoader() if there is one.
>
> The problem that I have is the LogFactoryImpl class is in the same class
> loader as LogFactory, so I am suggesting a change to LogFactory, such
> that the default class loader is used.  Patch is below.  Are there other
> problems that this does not address?
>

Haven't looked at the patch yet, but from your description it sounds like
this would break the use of commons-logging in a servlet container where
the commons-logging.jar file was in a shared directory and the desired
custom LogFactory implementation class was in the webapp.  Please make
sure that this use case works correctly.

> Any questions, comments, suggestions?
>
> If not, I will commit this.
>
> Scott
>

Craig


> Index: src/java/org/apache/commons/logging/LogFactory.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/Lo
> gFactory.java,v
> retrieving revision 1.6
> diff -u -r1.6 LogFactory.java
> --- src/java/org/apache/commons/logging/LogFactory.java 15 Mar 2002
> 22:57:36 -0000      1.6
> +++ src/java/org/apache/commons/logging/LogFactory.java 22 Apr 2002
> 16:48:12 -0000
> @@ -347,7 +347,7 @@
>
>          // Fourth, try the fallback implementation class
>          if (factory == null) {
> -            factory = newFactory(FACTORY_DEFAULT, classLoader);
> +            factory = newFactory(FACTORY_DEFAULT,
> LogFactory.class.getClassLoader());
>          }
>
>          if( props!=null ) {
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>


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


Mime
View raw message