You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Sara Prigge <sp...@LTCG.com> on 2002/01/25 00:19:57 UTC

Help finding XML config file

When I run my project locally, on my own machine, I have the XML config file
in the root of my project (using JBuilder 5).  I use a
DOMConfigurator.configureAndWatch("logging.xml") method.  This works just
fine.

When I'm using the XML config file in a J2EE application, I don't know where
to put this XML config file so it can be found.  I read log4j's FAQ and it
suggests trying to load the class or resource yourself.  I've tried to do
that by doing:
URL url = this.getClass().getResource("logging.xml");
DOMConfigurator.configure(url);

But, the url is always null; my config file is never found.  I looked at
Sun's ClassLoader javadoc and for the getResource method it says the method
will "first search the parent class loader for the resource; if the parent
is null the path of the class loader built-in to the virtual machine is
searched.  That failing, the method calls the findResource method."

I also tried working with the
Thread.currentThread().getContextClassLoader().loadClass() code from the FAQ
and couldn't get anything to work - I could never load a class using that
code. 

Any suggestions???

Sara Prigge


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>