Hibernate logback sql

I want to see the actual parameters of my SQL queries when using Hibernate. I add this to my logback.xml file to see requests (with question marks):

<logger name="org.hibernate.type" level="TRACE" /> 

but has no effect.

Is any special configuration required?

OnConsoleStatusListener shows me the correct configuration

 23:48:15,246 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.type] to TRACE 

but is not inferred from the org.hibernate.type package.

I am using Spring with Jpa.

+6
source share
4 answers

Things you need to make sure:

  • Are you sure SLF4J + LogBack works in your application?
  • Does your registrar point to any appender?
+2
source

Have you customized the added?

 <configuration> <appender name="FILE" class="ch.qos.logback.core.FileAppender"> <!-- "application-name" is a variable --> <File>c:/logs/${application-name}.log</File> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d %p %t %c - %m%n</Pattern> </layout> </appender> <root level="debug"> <appender-ref ref="FILE"/> </root> </configuration> 
+1
source

I use this configuration and it works for me:

 <logger name="org.hibernate.type" level="trace" additivity="false"> <appender-ref ref="consoleAppender" /> </logger> 
+1
source

The logger that works for me is this:

 <logger name="org.hibernate.type" level="TRACE" /> 
+1
source

All Articles