Spring_Hibernate中log4j不輸出信息到控制檯

所用的jar包已經引入,log4j.properties設置也沒問題,可就是在控制檯上不輸出信息 spring

試了試發現,在applicationContext.xml文件中設置的hibernateProperties名稱寫完整,也就是加上hibernate的前綴,結果就OK了。 sql

正常的在hibernate中配置相關的屬性時,前綴hibernate是能夠省略的。 session

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="mappingResources">
        <list>
            <value>com/bjsxt/registration/model/User.hbm.xml</value>
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">
                org.hibernate.dialect.MySQLDialect
            </prop>
            <prop key="hibernate.current_session_context_class">thread</prop>
            <prop key="hibernate.cache.provider_class">
                org.hibernate.cache.EhCacheProvider
            </prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.format_sql">true</prop>
        </props>
    </property>
</bean>
相關文章
相關標籤/搜索