使用Akka.Event.Logging记录器时有一种奇怪的行为。这似乎在使用WARN或ERROR日志级别时两次吐出相同的日志消息,但在INFO和DEBUG中没有。不确定这是一个错误还是我遗漏了什么。以下是消息的示例代码和屏幕截图:
public class ImagePersistanceActor : ReceiveActor, ILogReceive
{
LoggingAdapter log = Logging.GetLogger(Context);
public ImagePersistanceActor()
{
Receive<string>(message =>
{
Console.WriteLine("Echo from Recieve actor: " + message);
});
Receive<Object>(unhandledMsg => {
log.Warn("Unhandled message : " + unhandledMsg + " | Received at: " + DateTime.Now.Ticks);
Console.WriteLine(unhandledMsg);
});
}
}
void main(){
var receiveActor = system.ActorOf<ImagePersistanceActor>("receiveActor");
receiveActor.Tell("Hello world");
receiveActor.Tell(12233); //unhandled message
}
此处附带输出控制台屏幕截图:http://i.stack.imgur.com/3ReqJ.jpg