Skip to content

Commit

Permalink
Merge pull request #1811 from Horusiath/warn-default-serializer
Browse files Browse the repository at this point in the history
Warning about JSON.NET obsolete in v1.5
  • Loading branch information
Aaronontheweb committed Mar 25, 2016
2 parents 4619782 + 65ed99d commit ad8e5c1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/core/Akka/Actor/Internal/ActorSystemImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Akka.Dispatch;
using Akka.Dispatch.SysMsg;
using Akka.Event;
using Akka.Serialization;
using Akka.Util;


Expand Down Expand Up @@ -106,14 +107,30 @@ public void Start()
_logDeadLetterListener = SystemActorOf<DeadLetterListener>("deadLetterListener");

_eventStream.StartUnsubscriber(this);


WarnIfJsonIsDefaultSerializer();

if (_settings.LogConfigOnStart)
{
_log.Warning(Settings.ToString());
}
}

private void WarnIfJsonIsDefaultSerializer()
{
const string configPath = "akka.suppress-json-serializer-warning";
var showSerializerWarning = Settings.Config.HasPath(configPath) && !Settings.Config.GetBoolean(configPath);

if (showSerializerWarning &&
Serialization.FindSerializerForType(typeof (object)) is NewtonSoftJsonSerializer)
{
Log.Warning($"NewtonSoftJsonSerializer has been detected as a default serializer. " +
$"It will be obsoleted in Akka.NET starting from version 1.5 in the favor of Wire " +
$"(for more info visit: http://getakka.net/docs/Serialization#how-to-setup-wire-as-default-serializer ). " +
$"If you want to suppress this message set HOCON `{configPath}` config flag to on.");
}
}

public override IActorRef ActorOf(Props props, string name = null)
{
return _provider.Guardian.Cell.ActorOf(props, name: name);
Expand Down
4 changes: 4 additions & 0 deletions src/core/Akka/Configuration/Pigeon.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ akka {
# as they have been started; before that, see "stdout-loglevel"
# Options: OFF, ERROR, WARNING, INFO, DEBUG
loglevel = "INFO"

# Suppresses warning about usage of the default (JSON.NET) serializer
# which is going to be obsoleted at v1.5
suppress-json-serializer-warning = off

# Log level for the very basic logger activated during AkkaApplication startup
# Options: OFF, ERROR, WARNING, INFO, DEBUG
Expand Down

0 comments on commit ad8e5c1

Please sign in to comment.