Hibernate
log4j.logger.org.hibernate.tool.hbm2ddl=debug
log4j.logger.org.hibernate.engine.transaction=debug
Mybatis
在mybatis配置中添加下面的配置
<settings>
<setting name="logImpl" value="LOG4J" />
</settings>
在spring的SqlSessionFactory配置中添加以下配置
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configuration">
<bean class="org.apache.ibatis.session.Configuration">
<property name="logImpl" value="org.apache.ibatis.logging.log4j.Log4jImpl" />
</bean>
</property>
</bean>
在项目中的dao层中修改Level
com.mybatis.demo.dao=debug