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]>