Aisce  
          日歷
          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567
          統計
          • 隨筆 - 1
          • 文章 - 0
          • 評論 - 0
          • 引用 - 0

          導航

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

           

          2012年12月9日

          在spring的web項目中常常會在tomcat啟動的時候出現這種提示:
          引用
              log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
              log4j:WARN Please initialize the log4j system properly.
          網上有好多解決辦法都不管用,這個提示應該是讀入web應用程序的log4j.properties文件之前就報出來了。是在加載org.springframework.web.context.ContextLoader這個listener的時候沒找到log4j的配置文件造成的。
              仔細查看web.xml發現在加載org.springframework.web.context.ContextLoader這個listener之后才加載org.springframework.web.util.Log4jConfigListener,把log4j的配置放到org.springframework.web.context.ContextLoader之前,就可以解決這個問題了。
          Xml代碼
          1.<!-- 以下3項參數與log4j的配置相關 -->  
          2.      
          3.    <context-param>  
          4.        <param-name>log4jConfigLocation</param-name>  
          5.        <param-value>/WEB-INF/log4j.properties</param-value>  
          6.    </context-param>  
          7.      
          8.    <context-param>  
          9.        <param-name>log4jRefreshInterval</param-name>  
          10.        <param-value>60000</param-value>  
          11.    </context-param>  
          12.    <listener>  
          13.        <listener-class>  
          14.            org.springframework.web.util.Log4jConfigListener  
          15.        </listener-class>  
          16.    </listener>  
          17.<!-- end -->  
          18.  
          19.    <listener>  
          20.        <listener-class>  
          21.            org.springframework.web.context.ContextLoaderListener  
          22.        </listener-class>  
          23.    </listener>  

          posted @ 2012-12-09 23:04 Aisce.lin 閱讀(339) | 評論 (0)編輯 收藏
           
          Copyright © Aisce.lin Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 安宁市| 思南县| 葫芦岛市| 兰坪| 应用必备| 灵台县| 资中县| 连江县| 清涧县| 肥乡县| 福安市| 英山县| 松桃| 凉山| 定西市| 乌海市| 章丘市| 长丰县| 醴陵市| 襄城县| 遂川县| 临沂市| 正阳县| 九江市| 通辽市| 宝兴县| 桃江县| 宿迁市| 华亭县| 岳西县| 保山市| 广水市| 娱乐| 长葛市| 镇安县| 营口市| 昭平县| 葵青区| 沙河市| 通州区| 永嘉县|