Transferred from: http://blog.csdn.net/arvin_qx/article/details/6829873
When deploying two or more projects under Tomcat, it is best to define the Webapprootkey parameter in the Web. xml file and, if undefined, default to "Webapp.root", as follows:
<!--application path--><context-param><param-name>webapprootkey</param-name><param-value> Webapp.root</param-value></context-param>
It is best to ensure that the parameter values for each item are different to avoid conflicting items:
Web App root system property already set to different value: ' webapp.root ' = [C:\Program Files (x86) \apache SOFTW is Foundation\tomcat 6.0\webapps\drmproject\] instead of [C:\Program Files (x86) \apache software Foundation\tomcat 6.0\ Webapps\drmsn\]-Choose unique values for the ' Webapprootkey ' Context-param in your web. XML files!
For multiple projects to configure the Webapprootkey, here is to let log can write to the corresponding project root directory, as I configured these two items of Webapprootkey:
<!--application path--<context-param> <param-name>webAppRootKey</param-name> <param-value> webapp.root1</param-value> </context-param> ==================================<!--Application Path-- > <context-param> <param-name>webAppRootKey</param-name> <param-value>Webapp.root2 </param-value> </context-param>
So there will be no conflict.
Once defined, the absolute path to root is written to the system variable when the Web container is started.
You can then use ${webname.root} in the log4j configuration file to represent the absolute path to the Web directory and to store the log file in WebApp.
log4j and Web. XML configuration Webapprootkey issues (multiple apps deployed under one tomcat)