Last active
April 19, 2016 12:29
-
-
Save Danthar/b6b6afc9a2ec5583977191f6c9835fe1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<configSections> | |
<section name="akka" type="Akka.Configuration.Hocon.AkkaConfigurationSection, Akka"/> | |
</configSections> | |
<akka> | |
<hocon> | |
akka { | |
stdout-loglevel = DEBUG | |
logLevel = DEBUG | |
} | |
</hocon> | |
</akka> | |
<startup> | |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> | |
</startup> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) { | |
var system = ActorSystem.Create("LoggingTest", ConfigurationFactory.Load()); | |
Console.WriteLine("System loglevel: "+system.Settings.LogLevel); | |
var a = system.ActorOf<LogTestActor>(); | |
do | |
{ | |
a.Tell("test"); | |
var s = Console.ReadLine(); | |
if (s == "stop") | |
break; | |
} while (true); | |
system.Terminate().Wait(); | |
} | |
} | |
public class LogTestActor : ReceiveActor { | |
public LogTestActor() { | |
Receive<string>(s => { | |
Console.WriteLine($"DebugEnabled: {Context.GetLogger().IsDebugEnabled}"); | |
Console.WriteLine($"InfoEnabled: {Context.GetLogger().IsInfoEnabled}"); | |
Console.WriteLine($"ErrorEnabled: {Context.GetLogger().IsErrorEnabled}"); | |
Console.WriteLine($"WarningEnabled: {Context.GetLogger().IsWarningEnabled}"); | |
var logger = Context.GetLogger(); | |
logger.Debug("Debug stuff"); | |
logger.Info("Info stuff"); | |
logger.Error("Error stuff"); | |
logger.Warning("Warning stuff"); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment