Or you could add a life cycle listener that ran all your initialization
stuff when your app started.  The servlet initialization method will execute
for every context that you have defined.  That may or may not be the
behavior you want.

Subir

-----Original Message-----
From: juraj Lenharcik [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 7:18 AM
To: 'Tomcat Users List'
Subject: AW: Application init


Hi,

create a servlet with an init method like:

 public void init() { 
    file = getInitParameter("log4j-init-file");
    logfileDestination = getInitParameter("log4j-destination-file");
        ....
                DO LOG4J stuff
        .....
  }

and register it in your web.xml:
        <servlet>
                <servlet-name>log4j-init</servlet-name>
        
<servlet-class>com.di.config.startup.Log4jInit</servlet-class>
                <init-param>
                        <param-name>log4j-init-file</param-name>
                        <param-value>WEB-INF/classes/log4j.lcf</param-value>
                </init-param>
                <init-param>
                        <param-name>log4j-destination-file</param-name>
        
<param-value>d:/server/jakarta-tomcat-4.0.2-LE-jdk14/logs/jaas.log</param-va
lue>
                </init-param>
                <load-on-startup>0</load-on-startup>
that should do the work.

naskledanou...
juraj


-----Ursprüngliche Nachricht-----
Von: Pekník Jan [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 24. April 2002 16:13
An: 'Tomcat Users List'
Betreff: Application init


Hello, 

I have following problem : 

I have web-application consisting of several JSP, servlets, xml and xsl
files. I'm using LOG4J for logging and JDBC driver for acessing database.
In order to my application work properly, I need to call start-up code
(which set-up LOG4J and build connection pool) before any JSP page or
servlet is opened.
I don't know how to do this if I don't want to test this in the top of every
page / servlet.

Is there any easy solution how achieve this?  

                -Jan 

---
Odchozí zpráva neobsahuje viry.
Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz).
Verze: 6.0.351 / Virová báze: 197 - datum vydání: 19.4. 2002
 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to