ps0604 ps0604 - 3 months ago 26
Scala Question

Change Logback logging in Play standalone

When I create a Scala Play

web
application, Play generates a
conf/logback.xml
file that allows me to configure how the application logs.

I created a Scala Play
standalone
application and when I include Slick statements I get the following in the console:

21:46:04.811 [AsyncExecutor.default-16] DEBUG slick.jdbc.JdbcBackend.statement - Preparing statement: insert into report_data (cert,repdte,p3gtypar,p3gty,p3gtygnm,p9gtypar,p9gty,p9gtygnm,nagtypar,nagty,nagtygnm) values (5352,'2015-12-31',0,0,0,0,0,0,0,0,0)
21:46:04.811 [AsyncExecutor.default-16] DEBUG slick.jdbc.JdbcBackend.benchmark - Execution of prepared statement took 43µs
21:46:04.811 [AsyncExecutor.default-16] DEBUG slick.jdbc.StatementInvoker.result - 1 rows affected
21:46:04.811 [main] DEBUG slick.backend.DatabaseComponent.action - #1: [fused] asTry


There's no lockback file in Scala standalone. How to change logging options?

Answer

Add the following dependency in build.sbt

"org.slf4j" % "slf4j-nop" % “1.6.4"

And add slick logger setting which is below to logback.xml

<logger name="slick.jdbc" level="ERROR" />

Comments