SCdF
SCdF

Reputation: 59368

Getting hibernate to log clob parameters

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

How do you get hibernate to log clob values it's going to insert. It is logging other value types, such as Integer etc.

I have the following in my log4j config:

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'll note that it never displays parameter: 3 which is our clob.

What I would really want 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 get it to show this in the log?

Upvotes: 4

Views: 3242

Answers (3)

talg
talg

Reputation: 1779

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

Upvotes: 0

SCdF
SCdF

Reputation: 59368

Well, it looks like you can't. (Thanks Marcio for the suggestion, but sadly that didn't add anything useful)

Upvotes: 1

Marcio Aguiar
Marcio Aguiar

Reputation: 14577

Try using:

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

That's the finest level you'll get. If it does not show the information you want, then it's not possible.

Upvotes: 1

Related Questions