Apama 10.15.0 | Connecting Apama Applications to External Components | Working with IAF Plug-ins | C/C++ Plug-in Support APIs | Logging from IAF plug-ins in C/C++
 
Logging from IAF plug-ins in C/C++
This API provides a mechanism for recording status and error log messages from the IAF runtime and any plug-ins loaded within it. Plug-in developers are encouraged to make use of the logging API instead of custom logging solutions so that all the information may be logged together in the same standard format and log file(s) used by other plug-ins and the IAF runtime.
The logging API also allows control of logging verbosity, so that any messages below the configured logging level will not be written to the log. The logging level and file are initially set when an adapter first starts up; see Logging configuration (optional) for more information about the logging configuration.
The C/C++ interface to the logging system is declared in the header file AP_Logger.h, which can be found in the include directory of your Apama installation. All users of the logging system should include this header file. The types and functions of interest to IAF plug-in writers are:
*AP_LogLevel
AP_LogLevel_NULL means no log level has been set and should be interpreted by IAF and plug-ins as use the default logging level.
*AP_LogTrace
Along with the other logging functions below, AP_LogTrace is based on the standard C library printf function. The message parameter may contain printf formatting characters that will be filled in from the remaining arguments.
*AP_LogDebug
*AP_LogInfo
*AP_LogWarn
*AP_LogError
*AP_LogCrit
The logging API offers other functions to set and query the current logging level and output file. While these functions are available to plug-in code, it is recommended that plug-ins do not use them. The IAF core is responsible for updating the state of the logging system in response to adapter reconfiguration requests.