6

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

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

but to no effect.

Is there any special configuration necessary?

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 no output from org.hibernate.type package.

I'm using Spring with Jpa.

lincetto
  • 972
  • 2
  • 13
  • 28

4 Answers4

2

Things you have to make sure:

  1. Are you sure that SLF4J + LogBack is working in your app?
  2. Is your logger pointing to any appender?
Adrian Shum
  • 38,812
  • 10
  • 83
  • 131
  • 1
    Yes to both questions, I'm using ConsoleAppender and I see every other log output (for example spring logging) and some other hibernate logging – lincetto Nov 07 '12 at 00:05
1

Have you configured an appended?

<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>
Tinman
  • 786
  • 6
  • 18
1

I'm using this configuration, and it works for me:

<logger name="org.hibernate.type" level="trace" additivity="false">
  <appender-ref ref="consoleAppender" />
</logger>
  • 1
    If I use `ref="STDOUT"` this also works for me. That is because we have ``[…] already in the configuration, and a `ref` needs to refer to a name, not a `class`. – mirabilos Feb 09 '16 at 09:58
1

The logger that works for me is the following:

<logger name="org.hibernate.type" level="TRACE" />
nullPainter
  • 2,676
  • 3
  • 22
  • 42