It is natural to use ActorLogging when you need to provide a logger instance inside your Actor. Yet from time to time you might see instead logging traits (ie. LazyLogging or StrictLogging) from scala-logging. Usually, that could be seen in the code where Actor Model meets Dataflow or Reactive Streams. Can we use those two solutions interchangeably? Let’s look into details.
ActorLogging is deeply integrated with Akka. By default, it provides a Mapped Diagnostic Context (see DiagnosticActorLogging) with a bunch of useful information, including a full path of the actor in the actor tree. Also, some of the logging settings are shared with Akka configuration, so if you change for instance akka.loglevel in your application.conf it will have an effect on logs reported by your actor. It is also important to note that log instance provided by ActorLogging is supposed to be used inside an actor, so do not propagate it to deferred computations (ie. Futures).
scala-logging is a more general solution. Having no connections to Akka, it cannot provide a proper context of the actor. Also, logging configuration is completely separated from Akka settings. There is no need to protect logger instance, so you can pass it whenever you need it.
To sum up, whenever logging occurs inside an Actor body - use ActorLogging to keep the context of the logging information. In all other places, use scala-logging.
Here is a simple application which shows a difference between discussed logging using default configurations: