diff --git a/src/neo/LogLevel.cs b/src/neo/LogLevel.cs index 1aeef70a10..0c1c84334d 100644 --- a/src/neo/LogLevel.cs +++ b/src/neo/LogLevel.cs @@ -1,11 +1,13 @@ +using static Akka.Event.LogLevel; + namespace Neo { public enum LogLevel : byte { - Fatal, - Error, - Warning, - Info, - Debug + Debug = DebugLevel, + Info = InfoLevel, + Warning = WarningLevel, + Error = ErrorLevel, + Fatal = Error + 1 } } diff --git a/src/neo/NeoSystem.cs b/src/neo/NeoSystem.cs index 301df2c5d6..aa18723e01 100644 --- a/src/neo/NeoSystem.cs +++ b/src/neo/NeoSystem.cs @@ -12,7 +12,7 @@ namespace Neo public class NeoSystem : IDisposable { public ActorSystem ActorSystem { get; } = ActorSystem.Create(nameof(NeoSystem), - $"akka {{ log-dead-letters = off }}" + + $"akka {{ log-dead-letters = off , loglevel = warning, loggers = [ \"{typeof(Utility.Logger).AssemblyQualifiedName}\" ] }}" + $"blockchain-mailbox {{ mailbox-type: \"{typeof(BlockchainMailbox).AssemblyQualifiedName}\" }}" + $"task-manager-mailbox {{ mailbox-type: \"{typeof(TaskManagerMailbox).AssemblyQualifiedName}\" }}" + $"remote-node-mailbox {{ mailbox-type: \"{typeof(RemoteNodeMailbox).AssemblyQualifiedName}\" }}" + diff --git a/src/neo/Utility.cs b/src/neo/Utility.cs index 984422512e..c5145ad760 100644 --- a/src/neo/Utility.cs +++ b/src/neo/Utility.cs @@ -1,3 +1,5 @@ +using Akka.Actor; +using Akka.Event; using Microsoft.Extensions.Configuration; using Neo.Plugins; using System; @@ -6,6 +8,15 @@ namespace Neo { public static class Utility { + internal class Logger : ReceiveActor + { + public Logger() + { + Receive(_ => Sender.Tell(new LoggerInitialized())); + Receive(e => Log(e.LogSource, (LogLevel)e.LogLevel(), e.Message.ToString())); + } + } + /// /// Load configuration with different Environment Variable ///