Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot log evolutions #389

Open
jdelafon opened this issue Mar 10, 2017 · 5 comments
Open

Cannot log evolutions #389

jdelafon opened this issue Mar 10, 2017 · 5 comments

Comments

@jdelafon
Copy link

With the standard jdbc module in Play, one can log evolutions being applied by adding this to "logback.xml":

  <logger name="play.api.db.evolutions" level="DEBUG" />

Unfortunately it does not work anymore with play-slick. I could not find another logger concerning evolutions in the documentation. I am only running evolutions in tests, on an empty MySQL database - not sure if it matters.

N.B. That one will only log statements after evolutions have already been applied:

<logger name="slick.jdbc.JdbcBackend.statement" level="OFF" />
@marcospereira
Copy link
Member

@jdelafon
Copy link
Author

jdelafon commented May 8, 2017

It does not. Is it supposed to? I have this:

logSql=true

<!-- Show SQL (jdbc) -->
<logger name="com.jolbox.bonecp" level="OFF">
  <appender-ref ref="STDOUT" />
</logger>
<logger name="com.zaxxer.hikari" level="OFF">
  <appender-ref ref="STDOUT" />
</logger>
<logger name="org.jdbcdslog.ConnectionLogger" level="OFF" /> 
<logger name="org.jdbcdslog.StatementLogger"  level="OFF" /> 
<logger name="org.jdbcdslog.ResultSetLogger"  level="OFF" /> 

<!-- Slick -->
<logger name="slick.jdbc.JdbcBackend.statement" level="OFF" />
<logger name="slick" level="INFO"/>

<!-- Evolutions -->
<logger name="play.api.db.evolutions" level="DEBUG" />

Setting any of this to DEBUG or INFO will not log evolutions.

@iref
Copy link
Contributor

iref commented May 23, 2017

I think I found root of the problem. Slick evolutions work directly with java.sql.Connection that is retrieved from data source. Because evolution scripts are run on raw connection and don't use Slick session and aren't picked up by slick.jdbc.JdbcBackend.statement.
On the other hand, jdbcdslog is instrumented by wrapping datasource to LogSqlDataSource in play-jdbc module. So in this jdbcdslog is not enabled because play-slick does not use play-jdbc.
@marcospereira is this correct reasoning or am I way off? :)

@jdelafon As workaround, you can try to enable logging in jdbc driver.

@jdelafon
Copy link
Author

jdelafon commented May 23, 2017

@iref Thanks for digging into it.
I am not sure what you mean with the workaround, but I already tried the loggers above (like org.jdbcdslog.StatementLogger) and they don't show evolutions either. It is not problematic for me anymore right now, so I can wait for a fix.
[Edit closed by mistake]

@jdelafon jdelafon reopened this May 23, 2017
@iref
Copy link
Contributor

iref commented May 23, 2017

For example, you can add org.postgresql DEBUG logger to log statements to postgresql.
This is vendor specific and not every jdbc driver supports it. Play JDBC uses jdbcdslog to solve this for all vendors. So you can use this as alternative until play-slick fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants