Why isn't my akka logging working inside of play

akka, playframework, scala

Solution

Notice how your logback.xml has this line,

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

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

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

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

Problem

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..") ... } ``` When I create this actor I don't see the logging entries in either the log file or stdout. I have the default application.conf from this activator template: https://github.com/playframework/play-scala/blob/master/conf/logback.xml Do I need to modify my logback file with some akka label? Update 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 } } } ``` 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 ``` My logback.xml looks like: ``` <!-- https://www.playframework.com/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> ``` I do not see any akka related logs in STDOUT or in my log files that I create using the ActorLogging log method.

Original source

Related problems