Aisce  
          日歷
          <2012年12月>
          2526272829301
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345
          統計
          • 隨筆 - 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: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 娱乐| 当阳市| 麻栗坡县| 景谷| 香港 | 崇信县| 潼关县| 临颍县| 邮箱| 长治县| 穆棱市| 平阴县| 孟津县| 巩义市| 海丰县| 都江堰市| 泾川县| 应用必备| 桑日县| 会泽县| 清远市| 长泰县| 通化县| 尼勒克县| 贞丰县| 龙海市| 临泽县| 屏南县| 元氏县| 康定县| 南靖县| 长宁县| 靖宇县| 汝州市| 锦屏县| 育儿| 尼勒克县| 兴宁市| 石泉县| 达州市| 桃江县|