Hi,

> Well, maybe you guys have had to solve this kind of problem before.  I want

This is a common problem, and environment-based solutions for it will break
because they're fundamentally against the spirit of the Servlet and J2EE specs.
 The main reason these solutions will eventually break is that both specs don't
guarantee and explicitly discourage applications from writing files anywhere in
the server installation (except an explicitly provided temporary directory,
which is probably not what you want for logs).  

Accordingly, the portable solutions are ones that involve:
- External directories/paths for the log files, explicitly configured, and
usually resulting in one WAR per environment (dev1, test, production, etc.). 
You can put these in configuration files once, as ant tokens, and replace them
dynamically when packaging a WAR or deploying the webapp: Andy suggested this
approach and it's good.

- JNDI resolution, usually via the env-entry-ref approach in web.xml, which
leaves the location of the log file to the server administrator.  This might
seem heavyweight, but it's very portable, very standard, and server admins will
love you.

> properties.  If I find properties starting with "jboss" then it is jboss.
> If I find properties starting with "tomcat" (not "catalina) then it is
> tomcat.

This is a good example of what I'm saying: we (in the tomcat world) are in the
process of making sure we're consistent on catalina, not a mixture of tomcat
and catalina, as it applies to system properties, class names, etc.  And there
are already discussions of changing the container name (keeping the Tomcat
product name) from catalina to something else for Tomcat 6.0.

> But I would be interested in knowing how people have solved the log file
> location problem.  We also have to contend with Windows and Linux
> installations, so just having a common, external directory doesn't help.  Or
> maybe I am missing something basic here.  Whatever we set in the
> configuration file, I want it to work in our development env, the base
> deployment env, and on Windows and Linux.

What you have is a common desire and/or common problem.  It is raised routinely
on the tomcat-user list.  The answer is in the first paragraph above, so it's
probably not the answer you want to here, but there it is ;)

I won't even go into the case of more exotic servlet containers, like certain
versions of Oracle's, that don't give you ANY explicit filesystem access except
for the temp dir I mentioned above (javax.servlet.context.tempdir). ;)

Yoav Shapira http://www.yoavshapira.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to