Logging and configuration
For Java plug-ins, the plug-in's constructor is passed a configuration object, the chain name and a logger object. The Abstract classes supplied store these as members (the logger object is named logger).
For C++ plug-ins, the Abstract classes have a logger member with methods to log at log levels from TRACE to CRIT, with a printf format and variadic arguments. Expensive computations can be predicated on a check of is<Level>Enabled().
Plug-ins should use the slf4j
logger object provided for logging. You should avoid using
System.out or
System.err for logging. For both plug-ins written in C++ and Java, log messages are prefixed with
connectivity.PluginName.ChainName, which is also the category to configure log levels using the
correlatorLogging section in the YAML configuration file (see
Setting correlator log levels in a YAML configuration file). This means, it is not required to identify the plug-in or chain in every log statement.
The configuration contains the definitions from the configuration file for connectivity plug-ins (any globalConfig is merged with the per-chain configuration so that the per-chain configuration takes precedence). The configuration is a map with String keys. The values will be one of the following classes:
List<Object> (for C++,
data_t of type
list_t) for list YAML entries. Each element will be one of these types.
Map<String, Object> (for C++,
data_t of type
map_t) for map YAML entries. Each value will be one of these types.
String (for C++,
data_t of type
const char *). Even if the entry in the configuration file is numeric or a boolean, it will be provided as a string. Plug-ins can use the
MapHelper class to obtain numeric or boolean flags.
You can also use the Diagnostic codec to diagnose issues with connectivity plug-ins. See
The Diagnostic codec connectivity plug-in for further information.