Thank you for the tip, this is definitely working and is not too ugly.

However I still find a little bit stupid we have to create a new Servlet just to use 
its init method. Or maybe not if your Log4j servlet allows you to modify the logging / 
the log4j properties remotely (but that is another project, and it is bad not to use 
struts for that).

I tried just to extend the ActionServlet and rewrite the init method (adding lines to 
it). After modifying the web.xml, it still did not work. Has anyone a clue why? Did 
anybody try to extend ActionServlet?

Regards,

Fabien

"Abraham Kang" <[EMAIL PROTECTED]> writes:

> Hi Fabien,
> 
>    I typically do this in a StartupServlet in my web.xml.
> 
>    Here is an example of how I initialize Log4j:
> 
> <web-app>
> 
>   <context-param>
>     <param-name>weblogic.jsp.keepgenerated</param-name>
>     <param-value>true</param-value>
>   </context-param>
> 
>   <servlet>
>     <servlet-name>log4j</servlet-name>
> 
> <servlet-class>com.infogain.DOG.logging.servlet.Log4jServlet</servlet-class>
>     <init-param>
>       <param-name>debug</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <init-param>
>       <param-name>wlpi_log4j_conf</param-name>
>       <param-value>/WEB-INF/wlpi_log4j_conf.properties</param-value>
>     </init-param>
>     <init-param>
>       <param-name>base_category</param-name>
>       <param-value>com.infogain.DOG</param-value>
>     </init-param>
>     <init-param>
>       <param-name>base_priority</param-name>
>       <param-value>info</param-value>
>     </init-param>
>   <load-on-startup>1</load-on-startup>
>   </servlet>
> 
> ...
> 
>    The init() method of Log4jServlet handles stuff that needs to run before
> Struts (struts's <load-on-startup> is 2).
> 
> --Abraham
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
> > Fabien Le Floc'h
> > Sent: Wednesday, July 18, 2001 10:58 PM
> > To: [EMAIL PROTECTED]
> > Subject: web application initialization
> >
> >
> > Hi,
> >
> > I would like to know if it is possible to have some code called
> > at the web application initialization (something like the init()
> > method of the first servlet called by the web app - which here is
> > ActionServlet).
> >
> > Should I just extend ActionServlet?
> >
> >
> > regards,
> >
> > Fabien
> >
> >

Reply via email to