Aisce  
          日歷
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345
          統計
          • 隨筆 - 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 閱讀(346) | 評論 (0)編輯 收藏
           
          Copyright © Aisce.lin Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 英山县| 永泰县| 镶黄旗| 荥阳市| 泰兴市| 阳高县| 泸溪县| 武功县| 依兰县| 福清市| 岳阳市| 嘉兴市| 乌拉特中旗| 家居| 泾川县| 丁青县| 临湘市| 安徽省| 兴和县| 旬阳县| 龙山县| 五寨县| 城步| 昭平县| 灌云县| 都匀市| 宣城市| 嵩明县| 洪洞县| 南江县| 馆陶县| 全南县| 惠州市| 水城县| 元江| 曲沃县| 绥中县| 讷河市| 宁波市| 长兴县| 舒兰市|