Why don't extends the Action servlet ???
You can create a MyActionServlet which extends ActionServlet and initialize log4J.
Then you replace in the web xml the ActionServlet Class with the MyActionServlet
Class.
I didn't test it, but I think that it works.
Arnaud H
-----Message d'origine-----
De: Mark Schenk [SMTP:[EMAIL PROTECTED]]
Date: mardi 31 juillet 2001 11:25
A: [EMAIL PROTECTED]
Objet: RE: struts and log4J
>
> Hi all,
>
> I'm a newbie in struts.
> I'd like to use log4J with struts.
> I don't know where i must do the log4J configuration.
> In another servlet, i would do it in init method but i would like to use
> ActionServlet.
> Where can i put code like :
> BasicConfigurator.configure() ..... ?
>
Hello Alexandre,
I don't know if this is THE way of doing it, but what I did is create
a servlet (which I name 'Initializer') that does all these thing (calling
configure and stuff). I my web.xml I have:
<servlet>
<servlet-name>initializer</servlet-name>
<servlet-class>MyApp.Initializer</servlet-class>
<display-name>Initializer</display-name>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<display-name>Action</display-name>
<load-on-startup>2</load-on-startup>
</servlet>
(lots of administration left out of these...)
The 1 on the first servlet makes sure this one is loaded before the second
one. All initialization is done in the 'init' method of Initializer.
As I said, I don't know if this is the preferred way, but it works!
----------------------------------------------------------------------------
Mark Schenk | Ceci n'est pas une signature
Blackboard Project Manager |
Delft University of Technology |E-mail: [EMAIL PROTECTED]
Dept.: DTO |Phone: +31 152785448 (85448)
Room: LB00.680 |Fax: +31 152786359
----------------------------------------------------------------------------
-