Scala Spray + Reactive Mongo Logging

时间:2013-12-05 19:56:12

标签: spray reactivemongo

我正在使用喷雾罐和反应性mongo运行应用程序。我无法弄清楚如何关闭响应mongo的调试日志。我的application.conf文件(\ src \ main \ resources \ application.conf)如下所示:

akka {
  loglevel = "INFO"
}

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

1 个答案:

答案 0 :(得分:3)

您可以在应用程序中包含logger.xml logback配置文件。关闭所有active-mongo记录器的示例配置是:

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

类似的讨论可以在reactive-mongo google小组中找到:https://groups.google.com/forum/?fromgroups#!searchin/reactivemongo/log/reactivemongo/pYJ05dUAg-s/qqcKbJ2uHOAJ

希望这有帮助!