tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Alvarez Ferrando <>
Subject Re: Logging to File
Date Tue, 09 May 2000 06:58:57 GMT
Dave Boyer wrote:
> Steve Weiss wrote:
> > I'm doing something very similar, I put this in my application's
> > web.xml:
> >
> >     <context-param>
> >         <param-name>SYSLOG_FILE</param-name>
> >
> > <param-value>/home/steve/dev/java/webapps/currmit/logs/web.log</param-value>
> >     </context-param>
> >
> > Then I read in the SYSLOG_FILE parameter when my servlet is initialized
> > and open the file. Works fine for me (on Linux).
> >
> When you say you read in the SYSLOG_FILE parameter, what exactly do you mean?
> Class and function preferrably and where you read and process this parameter...
> Am I correct that the tomcat engine limits the access of a servlet to the system
> it's
> located on.  In other words, the classes are loaded within a sandbox of some
> type
> which limits the access of those files to system resources?
> So, I can't write files all over the System the servlet runs on.
> Am I correct that all JSP pages and all servlets within my web-app directory
> have access to the same ServletContext instance? If so this is the place to put
> my Logger.
> I would like to initialize some Application wide objects the first time any
> Servlet or JSP page is loaded.  I would like to create one instance of the
> logger, and a connection pool for interacting with an XML datasource.  Is there
> a way to do this without placing code in every single Servlet and JSP page to
> ensure that initialization has taken place?


I've built a JDBC connection pool I use in my applications, to
it I read configuration from a properties file from a static method in
one of my classes. To force execution of this code and read the
file, and for cleanup on server shutdown, I use a servlet that's loaded
on startup (configure this at server.xml).

Juan Alvarez Ferrando

> --------------------------------------------------------------------------
> To unsubscribe, email:
> For additional commmands, email:
View raw message