4
votes

When trying to troubleshoot a cluster setup in Akka.NET the cluster heartbeat messages are filling up the log.

[DEBUG][8/9/2016 6:04:32 PM][Thread 0011][[akka://mysystem/system/cluster/core/daemon#1680718572]] [Initialized] Received Akka.Cluster.GossipStatus

Is there a way to prevent this log event selectively as there appears to be possible with Akka for JVM?

2

2 Answers

5
votes

I faced the same issue. There were too many gossip messages in the log and I wanted to prevent this.

Here is a solution.

https://github.com/akkadotnet/akka.net/blob/v1.1.2/src/core/Akka.Cluster/Configuration/Cluster.conf#L77

So to avoid polluting the log with GossipStatus messages like this one (similar to your example):

[DEBUG][2016-12-26 1:48:36 PM][Thread 0004][[akka://mysystem/system/cluster/core/daemon#1458732427]] [Initialized] Received Akka.Cluster.GossipStatus

You just need to set the following option off:

cluster {
    log-info = off
}

Meantime if you have remote option turned on like this:

remote {
    log-received-messages = on
}

Then you will still have some cluster gossip messages logged (as @Aaronontheweb mentioned), but these messages are different. Compare for example with this:

[DEBUG][2016-12-26 1:41:03 PM][Thread 0008][[akka://mysystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fmysystem%40127.0.0.1%3A4053-1/endpointWriter#1021888826]] received local message [RemoteMessage: Akka.Cluster.ClusterHeartbeatSender+HeartbeatRsp to [akka://mysystem/system/cluster/core/daemon/heartbeatSender#647951916]<+akka://mysystem/system/cluster/core/daemon/heartbeatSender from [akka.tcp://[email protected]:4053/system/cluster/heartbeatReceiver#497245242]]
[DEBUG][2016-12-26 1:41:04 PM][Thread 0010][[akka://mysystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fmysystem%40127.0.0.1%3A4053-1/endpointWriter#1021888826]] received local message [RemoteMessage: ActorSelectionMessage - Message: Akka.Cluster.GossipStatus - WildCartFanOut: False - Elements: system/cluster/core/daemon to [akka://mysystem/]<+akka://mysystem/ from [akka.tcp://[email protected]:4053/system/cluster/core/daemon#1365688409]]
[DEBUG][2016-12-26 1:41:04 PM][Thread 0009][[akka://mysystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fmysystem%40127.0.0.1%3A4053-1/endpointWriter#1021888826]] received local message [RemoteMessage: ActorSelectionMessage - Message: Akka.Cluster.ClusterHeartbeatSender+Heartbeat - WildCartFanOut: False - Elements: system/cluster/heartbeatReceiver to [akka://mysystem/]<+akka://mysystem/ from [akka.tcp://[email protected]:4053/system/cluster/core/daemon/heartbeatSender#2069081679]]
2
votes

Verbose heartbeat logging should be off by default https://github.com/akkadotnet/akka.net/blob/dev/src/core/Akka.Cluster/Configuration/Cluster.conf#L165

However, gossip messages such as this will be logged if you have Akka.Remote's log received messages turned on:

https://github.com/akkadotnet/akka.net/blob/dev/src/core/Akka.Remote/Configuration/Remote.conf#L121

In the JVM example you linked to before they're using a specific logger implementation (logback) to filter out the classname of the actor producing the log messages, rather than something built into Akka.NET itself. You could do the same using some of the higher-level logging frameworks such as Serilog or NLog in .NET.