2011-07-08 128 views
8

我正在尋找一種方法來設置Log4j(或任何其他記錄器),以便我可以在日誌中看到每當Spring創建一個bean或設置一個bean屬性。例如。這樣的事情:日誌Spring bean創建/依賴注入

1:00:00 Creating bean Foo ([email protected]) 
1:00:01 Creating bean Bar ([email protected]) 
1:00:02 Setting bean Foo ([email protected]) to Bar ([email protected]) 
(...) 

這很容易嗎?我使用Spring 2.5.6(沒有選擇那裏:/)和Log4j(版本並不重要,我期望)。

回答

6

貌似org.springframework.beans.factory.support.DefaultListableBeanFactory記錄器是你可以得到最好的。

此外,只需嘗試打開全部整個org.springframework的日誌記錄級別 - 也許你會發現更有用的東西。

+0

org.springframework。* = WebSphere部署中的所有技巧 –