简体   繁体   中英

How to tell hibernate to print the column name instead of column number in the log?

I was able the get the below log

Hibernate: insert into ORGANIZATIONALUNITCATALOG (ID, SYSTEMID) values (null, ?)
[main] DEBUG org.hibernate.type.LongType  - binding '0' to parameter: 1

after specifying the log4j properties as

log4j.logger.org.hibernate.sql=DEBUG
log4j.logger.org.hibernate.type=DEBUG

Is there a way to tell hibernate 3.2.x to show the binding column name instead of the column number? ie I'd like to see the log line as

[main] DEBUG org.hibernate.type.LongType  - binding '0' to parameter: SYSTEMID

log4j.logger.org.hibernate.type=TRACE should do it.

If you still have problems, try enabling trace on these too

log4j.logger.org.hibernate.SQL=TRACE
log4j.logger.org.hibernate.engine.query=TRACE
log4j.logger.org.hibernate.jdbc=TRACE

In addition make sure you have TRACE logging enabled in your config. Many times default config files will set logging at DEBUG as the lowest.

使用log4j.logger.org.hibernate=debug

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM