Re: Eclipse, log4j, etc.

"Todd O'Bryan" <[email protected]> Mon, 9 Feb 2004 04:24:10 -0500
Newsgroups gmane.comp.web.maverick.general
Message-ID <[email protected]>
Thanks for the help. That didn't fix it. The weekend's over and I'm 
back at work, so it will probably be
Friday before I have a chance to look at everything again.

Todd

On Feb 8, 2004, at 1:48 PM, Ed Thompson wrote:

> I have the following in my web.xml:
>
>   <servlet>
>     <servlet-name>log4j-init</servlet-name>
>     <servlet-class>org.ed4becky.mComics.Log4jInit</servlet-class>
>     <init-param>
>       <param-name>log4j-init-file</param-name>
>       <param-value>WEB-INF/log4j.properties</param-value>
>     </init-param>
>     <load-on-startup>1</load-on-startup>
>   </servlet>
>
> org.ed4becky.mComics.Log4jInit looks like this:
>
> /*
>  * Created on Sep 19, 2003
>  *
>  * To change the template for this generated file go to
>  * Window - Preferences - Java - Code Generation - Code and Comments
>  */
> package org.ed4becky.mComics;
>
>
> import org.apache.log4j.PropertyConfigurator;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
>
> public class Log4jInit extends HttpServlet {
>
>   public
>   void init() {
>   	System.out.println("entering Log4jInit.init()");
>     String prefix =  getServletContext().getRealPath("/");
>     String file = getInitParameter("log4j-init-file");
>     // if the log4j-init-file is not set, then no point in trying
>     if(file != null) {
> 	  System.out.println("processing profile for Log4jInit.init("
> 	  						+prefix+file+")");
>       PropertyConfigurator.configure(prefix+file);
>     }
> 	System.out.println("leaving Log4jInit.init()");
>   }
>
>   public
>   void doGet(HttpServletRequest req, HttpServletResponse res) {
>   }
> }
>
>
> log4j.properties is in the WEB-INF directoru of my app
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> [INVALID FOOTER]



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
[INVALID FOOTER]