is it possible to change the location of tomcats logs/localhost_access_log.* log file, without changing the server.xml file?
Best solution would be a SystemProperty or environment variable. I just don’t want to change the default tomcat installation of this, because I roll out dozens of tomcat to diffent hosts, which makes this a tiring and error-prone process.
Thanks
Solved this by taking the following steps:
On deployment a context file is generated in
tomcat_home/conf/Catalina/localhost/<contextpath>.xml:< Context path=”/contextpath”>
< Valve className=”org.apache.catalina.valves.AccessLogValve”
rotatable=”false”
directory=”/the/directory/to/log/to”
prefix=”access_log”
suffix=”.log”
pattern=”combined”
/>
tomcat_home/logs/localhost_access_log.*.txtfiles, since the Context/Valve-configuration is only additive and doesn’t overwrites an existing AccessLogValve.I know that this writes the logfile twice, and you have to know your contextpath, both is not a problem for my usecase. Another option is to remove the complete Valve tag in the server.xml (it changes the server.xml but is easy to automate).