diff --git a/docs/articles/utilities/logging.md b/docs/articles/utilities/logging.md index 6051533e4fe..0e6c29270b4 100644 --- a/docs/articles/utilities/logging.md +++ b/docs/articles/utilities/logging.md @@ -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(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`.