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 閱讀(347) | 評論 (0)編輯 收藏
           
          Copyright © Aisce.lin Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 轮台县| 浪卡子县| 仁怀市| 岱山县| 元阳县| 婺源县| 咸阳市| 清水河县| 耒阳市| 大荔县| 碌曲县| 凤阳县| 山东省| 资兴市| 攀枝花市| 孟州市| 于都县| 遂平县| 尚志市| 乌鲁木齐市| 泗洪县| 本溪| 青冈县| 博湖县| 新郑市| 盘山县| 望谟县| 岳池县| 华安县| 应用必备| 綦江县| 长海县| 会东县| 克什克腾旗| 夏河县| 隆林| 绍兴县| 即墨市| 德安县| 屏南县| 红安县|