From 9209a302c5492fca3ecdf42c9e27d4c20fa014cb Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Sun, 17 Jan 2016 20:38:36 +0100 Subject: [PATCH] =act #19496 add sender information in LoggingReceive --- .../src/test/scala/akka/event/LoggingReceiveSpec.scala | 9 ++++++--- .../src/main/scala/akka/event/LoggingReceive.scala | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/akka-actor-tests/src/test/scala/akka/event/LoggingReceiveSpec.scala b/akka-actor-tests/src/test/scala/akka/event/LoggingReceiveSpec.scala index fcfedea2a3..040c52bac2 100644 --- a/akka-actor-tests/src/test/scala/akka/event/LoggingReceiveSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/event/LoggingReceiveSpec.scala @@ -66,7 +66,8 @@ class LoggingReceiveSpec extends WordSpec with BeforeAndAfterAll { }) })) a ! "hallo" - expectMsg(1 second, Logging.Debug("funky", classOf[DummyClassForStringSources], "received unhandled message hallo")) + expectMsg(1 second, Logging.Debug("funky", classOf[DummyClassForStringSources], + "received unhandled message hallo from " + system.deadLetters)) expectMsgType[UnhandledMessage](1 second) } } @@ -91,7 +92,8 @@ class LoggingReceiveSpec extends WordSpec with BeforeAndAfterAll { val name = actor.path.toString actor ! "buh" within(1 second) { - expectMsg(Logging.Debug(actor.path.toString, actor.underlyingActor.getClass, "received handled message buh")) + expectMsg(Logging.Debug(actor.path.toString, actor.underlyingActor.getClass, + "received handled message buh from " + self)) expectMsg("x") } @@ -116,7 +118,8 @@ class LoggingReceiveSpec extends WordSpec with BeforeAndAfterAll { }) actor ! "buh" within(1 second) { - expectMsg(Logging.Debug(actor.path.toString, actor.underlyingActor.getClass, "received handled message buh")) + expectMsg(Logging.Debug(actor.path.toString, actor.underlyingActor.getClass, + "received handled message buh from " + self)) expectMsg("x") } } diff --git a/akka-actor/src/main/scala/akka/event/LoggingReceive.scala b/akka-actor/src/main/scala/akka/event/LoggingReceive.scala index d9acda9690..76ef420ea4 100644 --- a/akka-actor/src/main/scala/akka/event/LoggingReceive.scala +++ b/akka-actor/src/main/scala/akka/event/LoggingReceive.scala @@ -54,6 +54,7 @@ class LoggingReceive(source: Option[AnyRef], r: Receive, label: Option[String])( if (context.system.eventStream.logLevel >= Logging.DebugLevel) { val (str, clazz) = LogSource.fromAnyRef(source getOrElse context.asInstanceOf[ActorCell].actor) context.system.eventStream.publish(Debug(str, clazz, "received " + (if (handled) "handled" else "unhandled") + " message " + o + + " from " + context.sender() + (label match { case Some(l) ⇒ " in state " + l case _ ⇒ ""