Howdy, >I have tried to put it almost everywhere in my war file, but i keep getting >the nullpointerexcpetion. > >Anyone have advise on where to put it, or how to load it ?? > >I use this code : > >//Initialise logger >String resource = "\\WEB-INF\\log.xml"; >URL configFileResource = BidServerProxy.class.getResource(resource); >DOMConfigurator.configure(configFileResource.getFile());
You can put log4j.xml in WEB-INF/classes and log4j will automatically find it and configure itself. If you want to configure log4j using the classloader resource loader, the log4j.xml file has to be on the classpath: put it in WEB-INF classes and use BidServletProxy.class.getResource("/log4j.xml"); If you want to configure log4j using the servlet context resource loader, you can put log4j.xml anywhere under your docBase, e.g. under WEB-INF, and use ServletContext#getResource("/WEB-INF/log4j.xml"); Use this URL, or the InputStream from URL.openStream(), as the argument to the DOMConfigurator. Don't use getFile() or other File I/O APIs. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]