lincetto
lincetto

Reputation: 1002

hibernate logback sql

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.

Upvotes: 6

Views: 9219

Answers (4)

nullPainter
nullPainter

Reputation: 3056

The logger that works for me is the following:

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

Upvotes: 1

Drazen Grabovac
Drazen Grabovac

Reputation: 153

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

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

Upvotes: 1

Tinman
Tinman

Reputation: 786

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>

Upvotes: 1

Adrian Shum
Adrian Shum

Reputation: 40056

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?

Upvotes: 2

Related Questions