Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set logging level in Akka

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?

like image 327
Alexander Temerev Avatar asked Mar 31 '11 12:03

Alexander Temerev


1 Answers

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>
like image 67
Alexander Temerev Avatar answered Nov 05 '22 16:11

Alexander Temerev