Executor Logger

When you execute a request, the execute method will throw an exception if a robot generates an error. Other types of errors and warnings are reported through the ExecutorLogger interface. In the previous examples, we have not provided any ExecutionLogger when executing robots, which means means we get the default implementation that will write to system out. Let's see how the ExecutorLogger will report if one of our RoboServers goes offline.

The example configures a cluster with a RoboServer which is not online.

RoboServer rs = new RoboServer("localhost", 50000);
Cluster cluster = new Cluster("name", new RoboServer[]{rs}, false);
Request.registerCluster(cluster);

ExecutorLogger, offline server example


If you run this example if should print the following to the console:

RoboServer{host='localhost', port=50000} went offline. Connection refused

ExecutorLogger, offline RoboServer console output


Often you don't want to have your application writing directly to System.out, in that case you can provide a different ExecutorLogger implementation, you can do so when registering the cluster, like this


Request.registerCluster(cluster, new DebugExecutorLogger());
                              

Use DebugExecutorLogger


This example uses the DebugExecutorLogger() which will also print to System.out, but only if the API debugging is enabled. Alternative you can provide your own implementation of the ExecutorLogger, to control how error messages should be handled. Check the ExecutorLogger JavaDoc for additional details.