lerna-stack / akka-entity-replication

Akka extension for fast recovery from failure with replicating stateful entity on multiple nodes in Cluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Typed] The logger name of logs that an entity wrote is not the entity class name

negokaz opened this issue · comments

I have confirmed that this is not the logger name expected with lerna-stack/akka-entity-replication-sample

  • Expected: BankAccountBehavior
  • Actual: Recovering

log output:

node3_1      | 06:49:13.598 INFO  Recovering - [LEADER] Deposited(1623912553193,100) [balance: 1500, resent-transactions: 15]

We can resolve this with ActorContext.setLoggerName

defsetLoggerName(clazz: Class[_]): Unit

Akka 2.6.12 - akka.actor.typed.scaladsl.ActorContext

Implementation example

    Behaviors.setup { context =>
      context.setLoggerName(BankAccountBehavior.getClass)
      ReplicatedEntityBehavior[Command, DomainEvent, Account](

Log output

node1_1      | 09:21:16.455 INFO  BankAccountBehavior$ - [LEADER] Deposited(1623921676060,100) [balance: 8500, resent-transactions: 30]