Skip to content

Commit

Permalink
Update logging.md (#5928)
Browse files Browse the repository at this point in the history
* Update logging.md

* Fix linter warnings

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>
Co-authored-by: Aaron Stannard <aaron@petabridge.com>
  • Loading branch information
3 people committed May 26, 2022
1 parent ce1b8ef commit cfbdd5b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/articles/utilities/logging.md
Expand Up @@ -112,3 +112,28 @@ akka {
}
}
```

## Logging All Receive'd Messages

It is possible to log all Receive'd messages, usually for debug purposes. This can be achieved by implementing the ILogReceive interface:

```c#
public class MyActor : ReceiveActor, ILogReceive
{
public MyActor()
{
Receive<string>(s => Sender.Tell("ok"));
}
}

...

// send a MyActor instance a string message
myActor.Tell("hello");
```

In your log, expect to see a line such as:

`[DEBUG]... received handled message hello from akka://test/deadLetters`

This logging can be toggled by configuring `akka.actor.debug.receive`.

0 comments on commit cfbdd5b

Please sign in to comment.