Vagif Abilov
Vagif Abilov

Reputation: 9991

How to configure Akka.NET to log all messages received by actors?

I am trying to make Akka.NET log all messages received by actors but can't get this to work. Here's my configuration (I am using projects from Akka.NET bootcamp):

      akka {                
        stdout-loglevel = DEBUG
        loglevel = DEBUG
        log-config-on-start = on

        actor {
          debug {
            receive = on # log any received message
            autoreceive= on # log automatically received messages, e.g. PoisonPill
            lifecycle = on # log actor lifecycle changes
            event-stream = on # log subscription changes for Akka.NET event stream
            unhandled = on # log unhandled messages sent to actors
          }
        }
      }

I can see that the configuration works for other activities (I see debug messages about actor system initialization and shutdown) but nothing from actual messages sent to actors. I tried both C# and F# examples.

Upvotes: 12

Views: 3931

Answers (1)

Vagif Abilov
Vagif Abilov

Reputation: 9991

Found what I was missing. It's not enough to configure debug logging, an actor must implement a marker interface (with no methods) ILogReceive:

class ConsoleWriterActor : UntypedActor, ILogReceive

Upvotes: 26

Related Questions