Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress Web Service Development Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

12.4 Logging in Service Code

The easiest and best method for logging events in service code is to use the global Agent logger, rather than the Web services logger. The global Agent logger is best suited for services, handlers, connectors, and transports. This global log file, located at <installdir>/logs/agent.log, is instantiated automatically when the Agent is started.

Section 12.4.1 introduces the global Agent logger. Section 12.4.2 discusses the Web services logger in relation to services.

12.4.1 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:


The Agent logger cannot be used by the client or standalone services. Instead, use the Web services logger, Section 12.3.

12.4.2 Server-side Logging through the Web Services Logger

Although service code should use the global Agent logger (Section 12.4.1), be aware that the Agent automatically logs some Fatal and Error messages to the Web services logger which may be useful for debugging. This file is located in your <installdir>\logs directory.



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.