Skip to content

Logging and debugging

y-yoshinoya edited this page Feb 14, 2013 · 6 revisions

There are few ways of seeing the generated SQL

1) Using com.github.aselab.activerecord.inner.Relation#toSql. For example:

println(User.where(_.name like "john%").orderBy(_.age desc).toSql))

2) Set level logging to DEBUG. For example:

Using Logback, customize the xml configuration: (e.g.: src/main/resources/logback.xml)

<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%highlight(%-5level) %cyan(%logger{15}) - %msg %n</pattern>
    </encoder>
  </appender>
  <root level="DEBUG">
    <appender-ref ref="STDOUT" />
  </root>
</configuration>

You will see every statements, and a dump of result sets of the seesion.

Clone this wiki locally