zoukankan      html  css  js  c++  java
  • springMVC项目中配置log4j.properties路径

    log4j.properties不打到war包中,单独写到一个存放配置文件的文件夹中,在容器中将该文件夹放入classpath,在web.xml中可以如下配置:

      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext-dao.xml,classpath:SpringMVC.xml
        </param-value>
      </context-param>
    
    
      <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>classpath:db2client-cfg/log4j.properties</param-value>
      </context-param>
    
      <context-param>
        <param-name>log4jRefreshInterval</param-name>
        <param-value>60000</param-value>
      </context-param>
    
      <!-- 配置log4j.xml监听器-->
      <!--需要配置在 ContextLoaderListener之前-->
      <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
      </listener>
    
      <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>
  • 相关阅读:
    zookeeper历史版本下载
    RabbitMq集群搭建
    spring boot rabbitmq整合rabbitmq之消息持久化存储
    跨域
    Spring注入(IOC):
    AOP
    jsp自定义标签
    配置文件要注意的项
    线程
    URL转码
  • 原文地址:https://www.cnblogs.com/darange/p/9683262.html
Copyright © 2011-2022 走看看