Workarounds for log4j configuration content coverage

Source: Internet
Author: User
    When the jar package introduced in the project contains Log4j.xml or Log4j.properties, the configured log4j is overwritten, which invalidates the log4j of the configuration. To confirm whether it is overwritten, first check the path of the log4j profile read at the start of the project, you can find the service you configured under MyEclipse Server, and add the virtual machine parameter in the JDK startup key parameter:-dlog4j.debug
    When you start, you can see the load path of the log4j configuration file. When the discovery is actually overwritten, the problem can be resolved by specifying the read path to the log4j in Web. XML, configured as follows:
<!--log4j avoid being overwritten-
<context-param> 
  <param-name>log4jConfigLocation</param-name> 
  <param-value>WEB-INF/classes/log4j.properties</param-value> 
</context-param> 
<listener> 
  <listener-class>org.springframework.web.util.log4jconfiglistener</listener-class > 
</listener>

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.