Akka Toolkit has provided a akka.actor.ActorLogging component to support the logging feature. It is a trait useful with an Actor only and has a log function, as follows:
trait ActorLogging { this: Actor ⇒ def log: LoggingAdapter = { // only used in Actor, i.e. thread safe } }
We can use ActorLogging, as shown here:
class SimpleActor extends Actor with ActorLogger { def receive = { case _ => log.info("SimpleActor: receive inovoked.") } }