This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Web applications don't have a "src" directory. Their classes are stored either in WEB-INF/classes or in a jar in WEB-INF/lib. So you should base your design planning on that rule. Once you have figured out where you want the config file to go (I put mine in WEB-INF/classes) then you can figure out how to get your deployment procedure (where you build your WAR or EAR for the application) to put it there.
(Also you might want to spell "congfig" better than that... )
I cannot speak for other containers (although I would think it would be similar), but for Tomcat, all that is required is that "log4j.properties" exist directly under WEB-INF/classes or WEB-INF/lib in my web application, along with the log4j jar file in WEB-INF/lib.
If log4j-xxx.jar is located on the web application's classpath (ie WEB-INF/lib), Tomcat should attempt to implement log4j. If I am missing my log4j.properties, it sends a message to standard out (catalina.out) that log4j was not properly initialized.
Also, I haven't had to call "PropertyConfigurator.configure("log4j.properties");", it's generally been enough simply to call
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
Joined: Feb 11, 2003
Hi Paul & Pete,
Thanks for the response.
I have currently in WEB-INF/classes/log4j.properties -- works
When i place the file in WEB-INF/classes/com/somecompany/config/log4j.properties -- does not work
Please let me know how can i read from com/somecompany/config directory