Using the Global Agent Logger in Service Code
This section introduces how to use the global Agent logger. For a complete discussion, see Chapter 6, “Logging,” in the HydraExpress User Guide.
At Agent start-up, the Agent instantiates a global Agent logger, using it to record significant events related to general Agent processes and service execution. You have access to this logger in HydraExpress server-side code. You can also create your own loggers if you want to log information to locations other than the default log output file.
You can log information from any custom service that you write. In many cases, logging will be functionality added to a service with some other main purpose, but you might also create a service just to log some information.
The default Agent logger is defined in the file <installdir>\conf\loggers.xml.
From within a HydraExpress service, you can access the default Agent logger from the rwsf::LogManager singleton. For example, this code gets the default Agent logger and logs a message:
 
#include <rwsf/core/LogManager.h>
#include <rwsf/core/Logger.h>
 
rwsf::Logger logger = rwsf::LogManager.getLogger();
logger.info("My log message.");
NOTE: The Agent logger cannot be used by the client or standalone services. Instead, use the Web services logger, Logging in Client Code.