Getting hibernation to log clob options

(see here for the problem I'm trying to solve)

How do you get hibernation to write the clob values ​​that it will insert. It registers other types of values, such as Integer, etc.

In my log4j configuration, I have the following:

log4j.logger.net.sf.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.net.sf.hibernate.type=DEBUG
log4j.logger.org.hibernate.type=DEBUG

which produces output such as:

(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '0' to parameter: 2
(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '1' to parameter: 2

However, you will notice that it never displays parameter: 3which is our clob.

What I really would like is something like:

(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '0' to parameter: 2
(org.hibernate.type.ClobType) binding 'something' to parameter: 3
(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '1' to parameter: 2
(org.hibernate.type.ClobType) binding 'something else' to parameter: 3

How do I show this in a magazine?

+3
source share
3 answers

Try using:

log4j.logger.net.sf.hibernate=DEBUG
log4j.logger.org.hibernate=DEBUG

This is the best level you will get. If it does not display the information you need, then this is not possible.

+1

, , . ( , , , )

+1

Try setting log4j.logger.org.hibernate.type = TRACE and see if that helps.

0
source

Source: https://habr.com/ru/post/1696765/


All Articles