Search code examples
sqlloggingplayframeworkebeanplayframework-2.4

Play 2.4 - Display Ebeans SQL statement in logs


How to display SQL Statements in the log ? I'm using EBeans and it fails to insert for some reasons but I can't see what's the problem.

I tried to edit my config to:

db.default.logStatements=true

and add this to logback.xml

<logger name="com.jolbox" level="DEBUG" />

to follow some answers I found online, but it doesn't seem to work for 2.4…


Solution

  • Logging has changed with Play 2.4. Starting from now, to display the SQL statements in the console, simply add the following line to the conf/logback.xml file:

    <logger name="org.avaje.ebean.SQL" level="TRACE" />
    

    It should work just fine.

    As @Flo354 pointed out in the comments, with Play 2.6 you should use:

    <logger name="io.bean" level="TRACE" />