在Akka中设置日志记录级别 [英] Set logging level in Akka

查看:314
本文介绍了在Akka中设置日志记录级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用Akka开发了一个财务数据分发服务器,我想为该应用程序设置日志记录级别. akka.io上的文档最好是粗略的.他们说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"
}

我这样做了,但是尽管成功加载了akka.conf,日志记录仍然似乎处于"DEBUG"级别.那里可能是什么问题?

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

推荐答案

Akka似乎在默认配置下使用slf4j/logback日志记录.因此(从未记录)解决方案将是例如您的类路径中的以下logback.xml:

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>

这篇关于在Akka中设置日志记录级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆