Logging Spring bean initialization with Log4J

半城伤御伤魂 提交于 2019-12-04 02:23:56

You need to set "org.springframework.beans.factory.support.DefaultListableBeanFactory" to debug level. The output looks something like this:

... - Creating instance of bean ...
... - Finished creating instance of bean  ...

Update:

Add this to log4j.properties:

log4j.logger.org.springframework.beans.factory.support.DefaultListableBeanFactory=DEBUG

Keep in mind that Spring is using the commons-logging framework, therefore these lines will not appear in your Log4J logs. To redirect them use SLF4J. Add slf4j-api.jar, jcl-over-slf4j.jar, slf4j-log4j12.jar and log4j.jar to your lib directory and remove commons-logging.jar from it.

add to your log4j xml (check if you already have one with lavel ERROR, change it either INFO or DEBUG

<logger name="org.springframework">
        <level value="INFO" />
</logger>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!