log4j and Web.xml configuration Webapprootkey problems __web

Source: Internet
Author: User
Tags log4j

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.