Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging message/template fixes #1048

Merged
merged 1 commit into from
Jun 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/Akka.Cluster/Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,12 @@ public void LogInfo(string message)

public void LogInfo(string template, object arg1)
{
_log.Info(String.Format("Cluster Node [{0}] - " + template, SelfAddress, arg1));
_log.Info("Cluster Node [{0}] - " + template, SelfAddress, arg1);
}

public void LogInfo(string template, object arg1, object arg2)
{
_log.Info(String.Format("Cluster Node [{0}] - " + template, SelfAddress, arg1, arg2));
_log.Info("Cluster Node [{0}] - " + template, SelfAddress, arg1, arg2);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,18 @@ public ChaosDestination(IActorRef probe)
{
if (ChaosSupportExtensions.ShouldFail(_confirmFailureRate))
{
Log.Error(string.Format("[destination] confirm message failed (message = {0}, {1})", m.DeliveryId, m.I));
Log.Error("[destination] confirm message failed (message = {0}, {1})", m.DeliveryId, m.I);
}
else if (State.Contains(m.I))
{
Log.Debug(string.Format("[destination] ignored duplicate (message = {0}, {1})", m.DeliveryId, m.I));
Log.Debug("[destination] ignored duplicate (message = {0}, {1})", m.DeliveryId, m.I);
Sender.Tell(new Confirm(m.DeliveryId, m.I));
}
else
{
this.Add(m.I);
Sender.Tell(new Confirm(m.DeliveryId, m.I));
Log.Debug(string.Format("[destination] received and confirmed (message = {0}, {1})", m.DeliveryId, m.I));
Log.Debug("[destination] received and confirmed (message = {0}, {1})", m.DeliveryId, m.I);
}
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/Akka.Remote.TestKit/Conductor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,21 +281,21 @@ public void OnDisconnect(HeliosConnectionException cause, IConnection closedChan

public void OnMessage(object message, IConnection responseChannel)
{
_log.Debug(string.Format("message from {0}: {1}", responseChannel.RemoteHost, message));
_log.Debug("message from {0}: {1}", responseChannel.RemoteHost, message);
if (message is INetworkOp)
{
_clients[responseChannel].Tell(message);
}
else
{
_log.Debug(string.Format("client {0} sent garbage `{1}`, disconnecting", responseChannel.RemoteHost, message));
_log.Debug("client {0} sent garbage `{1}`, disconnecting", responseChannel.RemoteHost, message);
responseChannel.Close();
}
}

public void OnException(Exception ex, IConnection erroredChannel)
{
_log.Warning(string.Format("handled network error from {0}: {1}", erroredChannel.RemoteHost, ex.Message));
_log.Warning("handled network error from {0}: {1}", erroredChannel.RemoteHost, ex.Message);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/core/Akka.Remote/Endpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1225,9 +1225,8 @@ private bool WriteSend(EndpointManager.Send send)
"Internal error: Endpoint is in state Writing, but no association handle is present.");
if (_provider.RemoteSettings.LogSend)
{
var msgLog = string.Format("RemoteMessage: {0} to [{1}]<+[{2}] from [{3}]", send.Message,
_log.Debug("RemoteMessage: {0} to [{1}]<+[{2}] from [{3}]", send.Message,
send.Recipient, send.Recipient.Path, send.SenderOption ?? _system.DeadLetters);
_log.Debug(msgLog);
}

var pdu = _codec.ConstructMessage(send.Recipient.LocalAddressToUse, send.Recipient,
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Remote/Transport/AkkaProtocolTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ private void InitializeFSM()
})
.Default(d =>
{
_log.Debug(string.Format("Expected message of type Associate; instead received {0}", d));
_log.Debug("Expected message of type Associate; instead received {0}", d);
//Expect handshake to be finished, dropping connection
SendDisassociate(wrappedHandle, DisassociateInfo.Unknown);
nextState = Stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,8 @@ public bool ShouldDropInbound(Address remoteAddress, object instance, string deb
var drop = mode as Drop;
if (Rng.NextDouble() <= drop.InboundDropP)
{
var logString = string.Format("Dropping inbound [{0}] for [{1}] {2}", instance.GetType(),
remoteAddress, debugMessage);
if(_shouldDebugLog) _log.Debug(logString);
if (_shouldDebugLog) _log.Debug("Dropping inbound [{0}] for [{1}] {2}", instance.GetType(),
remoteAddress, debugMessage);
return true;
}
}
Expand All @@ -247,8 +246,8 @@ public bool ShouldDropOutbound(Address remoteAddress, object instance, string de
var drop = mode as Drop;
if (Rng.NextDouble() <= drop.OutboundDropP)
{
var logString = string.Format("Dropping outbound [{0}] for [{1}] {2}", instance.GetType(), remoteAddress, debugMessage);
if (_shouldDebugLog) _log.Debug(logString);
if (_shouldDebugLog)
_log.Debug("Dropping outbound [{0}] for [{1}] {2}", instance.GetType(), remoteAddress, debugMessage);
return true;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/core/Akka/Actor/FSM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ public void Schedule(IActorRef actor, TimeSpan timeout)
if(_debugLog != null)
send = () =>
{
_debugLog.Debug("{3}Timer '{0}' went off. Sending {1} -> {2}", name, message, actor,
_ref.IsCancellationRequested ? "Cancelled " : "");
_debugLog.Debug("{0}Timer '{1}' went off. Sending {2} -> {3}",_ref.IsCancellationRequested ? "Cancelled " : "", name, message, actor);
actor.Tell(this, Context.Self);
};
else
Expand Down Expand Up @@ -691,7 +690,7 @@ private StateFunction HandleEventDefault
{
return delegate(Event<TData> @event)
{
_log.Warning(String.Format("unhandled event {0} in state {1}", @event.FsmEvent, StateName));
_log.Warning("unhandled event {0} in state {1}", @event.FsmEvent, StateName);
return Stay();
};
}
Expand Down
10 changes: 3 additions & 7 deletions src/core/Akka/Serialization/Serialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public Serialization(ExtendedActorSystem system)
var serializerType = Type.GetType(serializerTypeName);
if (serializerType == null)
{
system.Log.Warning(string.Format("The type name for serializer '{0}' did not resolve to an actual Type: '{1}'",
kvp.Key, serializerTypeName));
system.Log.Warning("The type name for serializer '{0}' did not resolve to an actual Type: '{1}'",kvp.Key, serializerTypeName);
continue;
}

Expand All @@ -64,17 +63,14 @@ public Serialization(ExtendedActorSystem system)
if (messageType == null)
{

system.Log.Warning(string.Format(
"The type name for message/serializer binding '{0}' did not resolve to an actual Type: '{1}'",
serializerName, typename));
system.Log.Warning("The type name for message/serializer binding '{0}' did not resolve to an actual Type: '{1}'",serializerName, typename);
continue;
}

var serializer = namedSerializers[serializerName];
if (serializer == null)
{
system.Log.Warning(string.Format(
"Serialization binding to non existing serializer: '{0}'", serializerName));
system.Log.Warning("Serialization binding to non existing serializer: '{0}'", serializerName);
continue;
}
_serializerMap.Add(messageType,serializer);
Expand Down