cms-gem-daq-project / ctp7_modules

0 stars 13 forks source link

Add `log4cplus` initialization to the RPc modules #151

Closed lpetre-ulb closed 4 years ago

lpetre-ulb commented 4 years ago

As proposed in #139, this PR enables the use of the log4cplus logging system in the RPC modules.

Description

At module initialization, the log4cplus system is initialized and its configuration reloaded. The configuration is read from /mnt/persistent/gemdaq/etc/rpcsvc_log.properties with a fallback to an embedded default configuration. Therefore the different log4cplus logging macros can now be used through the code.

The default embedded configuration sends the logs from the INFO log level to the local syslog daemon with the pattern show below. It can overridden with the configuration file (not provided).

Currently the log4cplus library available on the CTP7 does not allow to use move semantics since it was compiled without C++11 support. One must then be careful how the API is used. This shortcoming will be lifted after a log4cplus recompilation.

Also, note that these ultra-legacy/stable modules have not been touched yet:

Types of changes

Motivation and Context

Closes #139

How Has This Been Tested?

Logging statements work as expected on the ULB setup. For e.g., the following logs are produced at module initialization when the logger configuration file is missing:

Aug 26 22:17:39 CTP7 local0.notice rpcsvc[8866]: rpcsvc: Client connected from 192.168.249.191
Aug 26 22:17:39 CTP7 local0.info rpcsvc[8866]: memory:  Memhub initialized a semaphore. Current semaphore value = 1
Aug 26 22:17:39 CTP7 user.info rpcsvc: eagle63[8866] - void initLogging() - Impossible to read the configuration file; defaulting to the embedded configuration.
[...]

Checklist:

lpetre-ulb commented 4 years ago

Comments are addressed. However, I think that the utils.h file should be refactored sooner than later in order to avoid creating a file which contains everything that has no place somewhere else.