tomcat-users mailing list archives

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?