1. 程式人生 > >INFO: Initializing Spring root WebApplicationContext log4j:3個WARN卡死的解決

INFO: Initializing Spring root WebApplicationContext log4j:3個WARN卡死的解決

啟動tomcat載入到這裡卡死,沒有任何輸出,如下

INFO: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

等很長時間沒有反應,這時很大可能是後臺已經報錯了,可能是檔案載入過成功出現了死迴圈,導致啟動不了,

ssm框架中可能是spring報錯,然而因為沒有配置log4j.properties檔案導致日誌沒有輸出,從而看不到報錯,此時

需要增加log4j.properties檔案,這個log4j檔案只要放在src目錄下就可以,log4j元件會自動載入log4j.properties檔案,

看到報錯後可以針對報錯資訊進行修改。