Could you not place the configuration file in the root of the /WEB-INF/classes/ ? Log4j will automatically find "log4j.xml" or "log4j.properties" if it is located there.
Alternatively you could use the Thread.currentThread.getContextClassLoader(), this should work well inside a Webapp. cheers, Paul Smith On Mon, 2003-09-08 at 12:23, Bhamidi Krishna wrote: > Hi, > > I am trying to configure log4j for an app. Currently, I have deployed > it on Tomcat. My code snippet is - > > .............. > String configFileName = "com.common.logger.xml"; > URL url = null; > Context ctx=null; > ctx = new InitialContext(); > url = ctx.getClass().getResource(configFileName); > ..................... > > I put the xml file under a directory structure under classes in my > web-app. The issue is that the URL is null. > > I also tried other options like making the string > \com\common\logger.xml and com\common\logger.xml > > Another approach I tried was to get Thread.currentThread.getClassLoader > and read the URL from there, I get a vague null pointer exception and > zip exception. > > I am sorry if this is a very elementary question, but I could not find > any solutions in the lists also. > > Krishna. > > > > --------------------------------- > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design software --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]