Logging
A logging interface is provided to handle log messages generated by the client. Most log messages are generated from background cluster tend thread(s) created for each client instance. Messages include node additions/removal and any errors when retrieving node status, peers, partition maps and racks. This information is critical to debug command failures resulting from cluster tend errors.
Enable Client Log
The log is global so it only needs to enabled once at application launch before instantiating AerospikeClient. The client provides a simple stdout log implementation that can be used for command line applications:
Log.setCallbackStandard()
A custom console log can be created by:
public class MyConsole implements Log.Callback {
public MyConsole() {
Log.setCallback(this);
}
@Override
public void log(Log.Level level, String message) {
// Write log messages to the appropriate place.
}
}
MyConsole console = new MyConsole();
Disable Client Log
The client log can be disabled by setting the log callback to null.
Log.setCallback(null);
Log Level
Client log messages can be filtered by log level.
ERROR Serious errors that require immediate attention.
WARN Warnings regarding cluster tend errors that might lead to command failures.
INFO Informational cluster changes including adding a node and removing a node from the cluster.
DEBUG Extra debug data.
Each level includes the levels above it, so INFO includes INFO, WARN and ERROR messages. Example:
Log.setLevel(Log.Level.INFO);