You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Dan Sieroka <si...@platespin.com> on 2001/05/22 20:43:28 UTC

Loader class

In the 0.9.1 version of log4j, the ClassLoader was retrieved via:
	ClassLoader loader = org.log4j.Category.class.getClassLoader();
now it is retrieved like this:
	ClassLoader loader = clazz.getClassLoader();

This allowed the log4j.properties file to be found anywhere in the
classpath.

It seems that the ClassLoader object can only be retrieved from a static
initiazation block of a class that is currently being loaded.

For example:  If we are in class A, and do:
	ClassLoader loader = A.class.getClassLoader(); it works
but if we use any other class:  
	ClassLoader loader = B.class.getClassLoader(); it does not work
(returns null)

So can the line:
	ClassLoader loader = clazz.getClassLoader();
be changed to:
	ClassLoader loader = ClassLoader.class.getClassLoader();
in some future version of log4j?

Dan




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