ps0604 ps0604 - 1 year ago 135
Scala Question

Change Logback logging in Play standalone

When I create a Scala Play

application, Play generates a
file that allows me to configure how the application logs.

I created a Scala Play
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 Source

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" />

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download