Spring_Hibernate中log4j不输出信息到控制台
所用的jar包已经引入,log4j.properties设置也没问题,可就是在控制台上不输出信息
试了试发现,在applicationContext.xml文件中设置的hibernateProperties名称写完整,也就是加上hibernate的前缀,结果就OK了。
正常的在hibernate中配置相关的属性时,前缀hibernate是可以省略的。
01 | < bean
id = "sessionFactory"
class = "org.springframework.orm.hibernate3.LocalSessionFactoryBean" > |
02 | < property
name = "dataSource"
ref = "dataSource"
/> |
03 | < property
name = "mappingResources" > |
04 | < list > |
05 | < value >com/bjsxt/registration/model/User.hbm.xml</ value > |
06 | </ list > |
07 | </ property > |
08 | < property
name = "hibernateProperties" > |
09 | < props > |
10 | < prop
key = "hibernate.dialect" > |
11 | org.hibernate.dialect.MySQLDialect |
12 | </ prop > |
13 | < prop
key = "hibernate.current_session_context_class" >thread</ prop > |
14 | < prop
key = "hibernate.cache.provider_class" > |
15 | org.hibernate.cache.EhCacheProvider |
16 | </ prop > |
17 | < prop
key = "hibernate.show_sql" >true</ prop > |
18 | < prop
key = "hibernate.format_sql" >true</ prop > |
19 | </ props > |
20 | </ property > |
21 | </ bean > |