Well, I actually got the properties file loading properly!
When I set undeployWars="false" in server.xml, I can still see my log messages inside my Tomcat console! Here's my corrected file (Log4jInitServlet): import java.io.File; import java.io.IOException; import java.util.Properties; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import org.apache.log4j.PropertyConfigurator; public class Log4jInitServlet extends HttpServlet { public void init() throws ServletException { Properties props = new Properties(); // String file = getServletContext().getInitParameter("log4j-init"); // File propFile = new File(file); // if (!propFile.exists()) { // System.out.println("log4j.properties file not found" + propFile.getAbsolutePath()); // } try { props.load(this.getClass().getClassLoader().getResourceAsStream("/log4j.properties")); } catch (IOException e) { e.printStackTrace(); } // PropertyConfigurator.configureAndWatch(propFile.getAbsolutePath(),10000); } } Now, my problem is that I can't use the PropertyConfigurator because I placed log4j.properties in WEB-INF/classes and then just placed it into my CLASSPATH using getResourceAsStream(). If you look at my code whihc contains the invocation to PropertyConfigurator, I need a File type to place as the first parameter inside the configureAndWatch() method. Is there a way to convert this stream as File? Happy holidays! -JD On 12/22/06, Hassan Schroeder <[EMAIL PROTECTED]> wrote:
On 12/22/06, James Dekker <[EMAIL PROTECTED]> wrote: > <Host name="localhost" appBase="webapps" > unpackWARs="true" autoDeploy="true" > xmlValidation="false" xmlNamespaceAware="false"> > </Host> > tomcat.home=C:/DevTools/tomcat/jakarta-tomcat-5.5.9 > tomcat.deployment.dir=${tomcat.home}/webapps Most of that was irrelevant :-) but the above doesn't mesh with your earlier path: C:\DevTools\tomcat\jakarta-tomcat-5.5.9\mywebapp\WEB-INF\classes\log4j.properties. :: which doesn't include a 'webapps' directory. Is that just a typo or are you setting Context atttributes (like docBase) somewhere else? -- Hassan Schroeder ------------------------ [EMAIL PROTECTED] --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]