Thai Thanh Ha wrote:

>  Please send it to me! Thanks!

i've had a little think and here's a code fragment rather than the class i
use.
(i'm a bit worried that it wouldn't work for your container. i have a very
new version of tomcat. also the class has grow a bit since i posted...)

(apologies for not testing this code - i think it's be ok but i'm sure that
you'll get the general idea)
put this in your servlet init code. conf is a string containing the path to
your properties file relative to the base of your web app.

 java.util.Properties props=new java.util.Properties();
 InputStream in=getServletContext().getResourceAsStream(conf);
 if (in!=null) {
   props.load(in);
   new
org.apache.log4j.PropertyConfigurator().doConfigure(props,Category.getDefaultHierarchy());

   in.close();
}

hope this helps.

PS. if you're using tomcat 4, logging to stdout will go into catalina.log.
also, if you're logging to file, you should specify an absolute path in
your properties file.

- robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to