An Actor mixin must be in the akka namespace?

I’m trying to create an Actor mixin trait (well, subclass), in order to override the various Actor lifecycle aroundX methods:

trait ActorLifecycleLogging extends Actor with ActorLogging {
  private def logIt(msg: String) = ???
  override protected[akka] def aroundPreStart(): Unit = {
    logIt("preStart")
    super.aroundPreStart()
  }
}

Because these methods are protected[akka], it seems I have to put it in an akka.actor sub-package?

I really don’t want my code polluting the akka namespace. Am I missing a better way to accomplish this?

The “around” methods are not intended for user extension, thus their designation as akka private internal APIs. You should use the normal callbacks, providing a base class and delegate to ‘super’ in your normal actors.