Logging in Client Code
For client-side and standalone server logging (Logging in a Standalone Service), use the Web service logger. This logger is implemented as a message handler and invoked statically via the rwsf::HandlerManager class. The simplest way to log a message in the client is to invoke the logger with a string and an optional log level describing the severity of the message:
 
#include <rwsf/webservice/HandlerManager.h> // required include
 
rwsf::HandlerManager::invokeLogger("This is an info message");
 
rwsf::HandlerManager::invokeLogger("This is a warning message",
rwsf::CallInfo::Warning);
In client code, the invokeLogger() method uses the logger defined in the client-handlers.xml file. If no logger configuration is found, then logging defaults to the default log file, webservice.log, located in your <installdir>\logs directory. This logger logs only messages at the Fatal or Error level, however.
To implement logging in the client
*Configure a logger in the client-handlers.xml file. The design of using a configuration file allows you to change the logging level and the output file name at runtime, without having to recompile your code.
*Load and define the logger from within your client code.
This process is described in detail in Configuring and Using a Client Logger.
By default, the code generator automatically creates a logger handler and places its configuration in the generated conf/client-handlers.xml file. The client code then loads the configuration using the loadConfiguration() method:
 
rwsf::HandlerManager::loadConfiguration("../conf/client-handlers.xml");
If you undefine the logger by commenting out the above line in the generated client implementation or removing the logger element in the client-handlers.xml, then only Error and Fatal messages are logged to the webservice.log file.