When two or more projects are deployed under Tomcat, it is best to define the Webapprootkey parameters in the Web.xml file, which, if not defined, will default to "Webapp.root", as follows: <!--application path--> <con Text-param> <param-name>webAppRootKey</param-name> <param-value>webapp.root</p Aram-value> </context-param>
Best newspaper The parameter values for each item are different to avoid project conflicts
Serious: Exception sending context initialized event to listener instance of class Org.springframework.web.util.Log4jConfigLis Tener
Java.lang.IllegalStateException:Web App root system property already set to different value: ' Webapp.root ' = [C:\Program Files (x86) \apache Software 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.XM L files!
To configure Webapprootkey for multiple projects, this is mainly to let log write logs to the corresponding project root directory, as I configured these two projects Webapprootkey for
XML code <!--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's no conflict.
Once defined, the absolute path of root will be written to the system variable when the Web container is started.
Then the log4j configuration file can be used ${webname.root} to represent the absolute path of the Web directory, the log file stored in the WebApp.