在启动应用时,有没有办法在控制台中显示hibernate属性值?
不是那么相关,但我正在使用Spring和Hibernate和JPA persitence.xml文件,我希望看到不同属性的设置,以确保我的配置文件被正确考虑(如“hibernate.connection”) .characterEncoding“或”hibernate.c3p0.timeout“)
PS:我知道 show_sql ,但这不是我想要的:)
答案 0 :(得分:2)
我的logback.xml包含以下行。
<appender name="dailyRollingFileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
....//some code
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
....//some code
</appender>
<logger name="your_package" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="dailyRollingFileAppender"/>
</logger>
<logger name="org.springframework" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="dailyRollingFileAppender"/>
</logger>
<logger name="org.hibernate" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="dailyRollingFileAppender"/>
</logger>
<root>
<appender-ref ref="dailyRollingFileAppender"/>
</root>
我已将org.hibernate
的级别设置为DEBUG
,因为以下hibernate属性被写入日志文件。
java.net.URLClassLoader@35f983a6
excludeUnlistedClasses: false
JTA datasource: null
Non JTA datasource: org.apache.commons.dbcp.BasicDataSource@24265b14
Transaction type: RESOURCE_LOCAL
PU root URL: file:****.jar
Shared Cache Mode: UNSPECIFIED
Validation Mode: AUTO
Jar files URLs []
Managed classes names []
Mapping files names []
Properties [
hibernate.connection.charSet: UTF-8
hibernate.dialect: org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.search.default.directory_provider: filesystem
hibernate.show_sql: false
hibernate.hbm2ddl.auto: none
hibernate.format_sql: false
hibernate.ejb.naming_strategy: org.hibernate.cfg.EJB3NamingStrategy]