Scala Spray + Reactive Mongo Logging

1.3k Views Asked by At

I'm running an application using spray-can and reactive mongo. I can't figure out how to turn of the debug logging for reactive mongo. My application.conf file (\src\main\resources\application.conf) looks like this:

akka {
  loglevel = "INFO"
}

spray.can.server {
  request-timeout = 1s
}
1

There are 1 best solutions below

0
On

You can include a logger.xml logback configuration file in your application. An example configuration which turns all of the reactive-mongo loggers off is:

<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%date{ISO8601} %highlight(%-5level) %yellow(%logger{50}) %cyan(%X{sourceThread}) - %msg%n</pattern>
    </encoder>
  </appender>

  <logger name="reactivemongo.api.Cursor" level="OFF" />
  <logger name="reactivemongo.api.Failover" level="OFF" />
  <logger name="reactivemongo.core.actors.MongoDBSystem" level="OFF" />
  <logger name="reactivemongo.core.actors.MonitorActor" level="OFF" />

  <root level="debug">
    <appender-ref ref="STDOUT" />
  </root>
</configuration>

A similar discussion can be found in the reactive-mongo google group: https://groups.google.com/forum/?fromgroups#!searchin/reactivemongo/log/reactivemongo/pYJ05dUAg-s/qqcKbJ2uHOAJ

Hope this helps!