我已经用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中设置日志记录级别
发布评论