Aisce  
          日歷
          <2012年12月>
          2526272829301
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345
          統計
          • 隨筆 - 1
          • 文章 - 0
          • 評論 - 0
          • 引用 - 0

          導航

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

           
          在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 on 2012-12-09 23:04 Aisce.lin 閱讀(346) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
           
          Copyright © Aisce.lin Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 阿拉善右旗| 枣阳市| 黎川县| 印江| 富蕴县| 儋州市| 上饶县| 安化县| 瑞金市| 施秉县| 融水| 河北省| 深州市| 清水河县| 大理市| 永昌县| 乾安县| 杭州市| 嘉祥县| 措勤县| 茂名市| 宜黄县| 固安县| 清镇市| 嘉祥县| 阿坝| 沙坪坝区| 霍山县| 师宗县| 张家界市| 大洼县| 通渭县| 蚌埠市| 平江县| 济阳县| 保康县| 日土县| 石泉县| 阿克陶县| 滁州市| 濉溪县|