log4j and Web. XML Configuration Webapprootkey issues __web

Source: Internet
Author: User
Tags tomcat log4j

When deploying two or more projects under Tomcat, it is best to define the Webapprootkey parameter in the Web. xml file, which, if undefined, defaults 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 conflicting items

Severity: 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!

For multiple projects to configure the Webapprootkey, here is to let log can write to the corresponding project root directory, such as I configured the Webapprootkey of the two projects for

XML code <!--application Path--<context-param> <param-name>webAppRootKey</param-name> <param-value>webapp.root1</param-value> </context-param> [XML] view plain copy < ;! --Application path--<context-param> <param-name>webAppRootKey</param-name> <par Am-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.


Original address: http://blog.csdn.net/arvin_qx/article/details/6829873

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.