开发者

Set logging level in Akka

开发者 https://www.devze.com 2023-02-21 05:42 出处:网络
I have developed a financial data distribution server with Akka, and I want to set logging level for the application. The documentation at akka.io is sketchy at the best; they say there is no more \"l

I have developed a financial data distribution server with Akka, and I want to set logging level for the application. The documentation at akka.io is sketchy at the best; they say there is no more "logging" in Akka and logging is defined through 开发者_运维问答event handlers now. There is also an example of event handler configuration, including logging level:

akka {
  event-handlers = ["akka.event.EventHandler$DefaultListener"]
  event-handler-level = "INFO"
}

I did that, but though akka.conf is successfully loaded, logging still appears to be at "DEBUG" level. What can be the problem there?


It appears that Akka uses slf4j/logback logging with default configuration. So the (never documented) solution would be to put e.g. the following logback.xml in your classpath:

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="false" debug="false">
  <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>[%4p] [%d{ISO8601}] [%t] %c{1}: %m%n</pattern>
    </encoder>
  </appender>
  <!-- you can also drop it completely -->
  <logger name="se.scalablesolutions" level="DEBUG"/> 
  <root level="INFO">
    <appender-ref ref="stdout"/>
  </root>
</configuration>
0

精彩评论

暂无评论...
验证码 换一张
取 消