在Akka中设置日志记录级别

编程入门 行业动态 更新时间:2024-10-27 20:38:45
本文介绍了在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中设置日志记录级别

本文发布于:2023-11-25 03:17:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628100.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:级别   日志   Akka

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!