Can someone share a minimal akka typed logging example? In akka classic I used LoggingReceive and set in src/main/resources/application.conf
akka {
loglevel = DEBUG
actor {
debug {
receive=on
}
}
}
but in Akka typed I'm unclear what to do. If possible, I'd like the logging to work with akka.actor.testkit as well
I tried just simply adding as suggested here
Behaviors.receive[String] { (ctx, message) =>
ctx.log.info("Received message: {}", message)
Behaviors.same
}
But nothing is printed which makes me think I might need to configure the backend somehow, perhaps with logback.xml (although I didn't understand this)
you can use the
ConfigFactory.load().getConfig()
and load a specific configuration to your application.Like this is my
application.conf
:and my application where I can call
context.log.debug()
directly because theAbstractBehavior
already extends ActorLogging.the logs will appear on the console like this: