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 an executor logger, a class implementing the IExecutorLogger interface. In the previous examples, we have not provided any execution logger when executing robots, which means that the default implementation ExecutorLogger that will write to system out will be used. 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.
Com.KapowTech.RoboSuite.Api.Engine.UnableToConnectException:...........
                            

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 IExecutorLogger 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.