为什么我的Akka日志无法在游戏中运行

编程入门 行业动态 更新时间:2024-10-26 03:31:43
本文介绍了为什么我的Akka日志无法在游戏中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的播放代码中的日志记录工作正常,但是我所拥有的akka​​代码未记录到文件/标准输出中.

My logging is working fine from within my play code, but the akka code I have isn't logging to file/stdout.

class EmailActor extends Actor with ActorLogging { import EmailActor._ log.info("email actor hatched..") ... }

创建此actor时,在日志文件或stdout中都看不到日志记录条目.

When I create this actor I don't see the logging entries in either the log file or stdout.

我具有此激活器模板的默认application.conf: github/playframework/play-scala/blob/master/conf/logback.xml

I have the default application.conf from this activator template: github/playframework/play-scala/blob/master/conf/logback.xml

我是否需要使用akka标签修改登录文件?

Do I need to modify my logback file with some akka label?

更新

我现在在我的application.conf中完成了此操作:

I have done this now in my application.conf:

akka { loggers = ["akka.event.slf4j.Slf4jLogger"] #loggers = ["akka.event.Logging$DefaultLogger"] loglevel = "DEBUG" logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" actor { debug { lifecycle = on } } }

在我的依赖项中,我已经添加了这个(并且都添加到了我的play应用的dep中):

In my dependencies I have added this (and are both added to my play app's dep):

val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % Version.akkaSlf4j val logback = "ch.qos.logback" % "logback-classic" % Version.logback

我的logback.xml看起来像:

My logback.xml looks like:

<!-- www.playframework/documentation/latest/SettingsLogger --> <configuration> <conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel" /> <appender name="FILE" class="ch.qos.logback.core.FileAppender"> <file>${application.home:-.}/logs/application.log</file> <encoder> <pattern>%date [%level] from %logger in %thread - %message%n%xException</pattern> </encoder> </appender> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%coloredLevel %logger{15} - %message%n%xException{10}</pattern> </encoder> </appender> <appender name="ASYNCFILE" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="FILE" /> </appender> <appender name="ASYNCSTDOUT" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="STDOUT" /> </appender> <logger name="play" level="INFO" /> <logger name="application" level="DEBUG" /> <!-- Off these ones as they are annoying, and anyway we manage configuration ourselves --> <logger name="com.avaje.ebean.config.PropertyMapLoader" level="OFF" /> <logger name="com.avaje.ebeaninternal.server.core.XmlConfigLoader" level="OFF" /> <logger name="com.avaje.ebeaninternal.server.lib.BackgroundThread" level="OFF" /> <logger name="com.gargoylesoftware.htmlunit.javascript" level="OFF" /> <root level="WARN"> <appender-ref ref="ASYNCFILE" /> <appender-ref ref="ASYNCSTDOUT" /> </root> </configuration>

我没有在STDOUT或使用ActorLogging日志方法创建的日志文件中看到任何与akka相关的日志.

I do not see any akka related logs in STDOUT or in my log files that I create using the ActorLogging log method.

推荐答案

请注意您的logback.xml如何包含这一行,

Notice how your logback.xml has this line,

<logger name="play" level="INFO" />

允许loger_name等于播放"的记录器以INFO级别记录.

which allows a logger with loger_name equal to "play" to log at INFO level.

类似地,您需要将以下内容添加到logback.xml中,

Similarly, you will need to add the following to your logback.xml,

<logger name="akka.event.slf4j.Slf4jLogger" level="DEBUG" />

更多推荐

为什么我的Akka日志无法在游戏中运行

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

发布评论

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

>www.elefans.com

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