You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "André Warnier (tomcat)" <aw...@ice-sa.com> on 2016/01/13 15:36:27 UTC
property replacement in WEB-INF/web.xml
Hi gurus.
Under tomcat 8 and Linux, I am deploying an externally-provided web application, which in
its web.xml configuration file, has a parameter like this :
<init-param>
<param-name>logroot</param-name>
<param-value>/var/log/tomcat8</param-value>
</init-param>
This works, but I would like to make this more "generic", and would like to replace the
above param-value by something like this :
<init-param>
<param-name>logroot</param-name>
<param-value>${CATALINA_BASE}/logs</param-value>
</init-param>
with CATALINA_BASE being the well-known environment value set prior to starting (the JVM
which runs) Tomcat (and "${CATALINA_BASE}/logs" being actually a link which points to
"/var/log/tomcat8" in this case).
Can I do this ? and if yes, what is the exact way to do this right ?
(In a log4j configuration file, I can use "${env:CATALINA_BASE}" for this, but this is not
available under Tomcat, or is it ?)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: property replacement in WEB-INF/web.xml
Posted by Christopher Schultz <ch...@christopherschultz.net>.
André,
On 1/13/16 9:36 AM, André Warnier (tomcat) wrote:
> Hi gurus.
>
> Under tomcat 8 and Linux, I am deploying an externally-provided web
> application, which in its web.xml configuration file, has a parameter
> like this :
>
> <init-param>
> <param-name>logroot</param-name>
> <param-value>/var/log/tomcat8</param-value>
> </init-param>
>
> This works, but I would like to make this more "generic", and would like
> to replace the above param-value by something like this :
>
> <init-param>
> <param-name>logroot</param-name>
> <param-value>${CATALINA_BASE}/logs</param-value>
> </init-param>
>
> with CATALINA_BASE being the well-known environment value set prior to
> starting (the JVM which runs) Tomcat (and "${CATALINA_BASE}/logs" being
> actually a link which points to "/var/log/tomcat8" in this case).
>
> Can I do this ? and if yes, what is the exact way to do this right ?
>
> (In a log4j configuration file, I can use "${env:CATALINA_BASE}" for
> this, but this is not available under Tomcat, or is it ?)
I think you want to use the system property version of that value, which is:
<init-param>
<param-name>logroot</param-name>
<param-value}${catalina.base}/logs</param-value>
</init-parm>
I can't find it in the Tomcat documentation that this will work in a web
application's web.xml, but that's definitely how it works for server.xml
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org