QCG (Quality Control GUI) is deployed in multiple production instances, each serving a separate QCDB database. To ensure clear separation of logs and traceability across deployments, developers must follow specific logging conventions.
Logging in QCG should use the O2 Logging application from the @aliceo2/web-ui
framework. This wraps the Winston library and O2’s InfoLogger project, providing a unified logging interface.
Each QCG deployment (e.g., qcg
, qcg-mc
, qcg-async
) should have its own log label. This allows logs to be easily attributed to the correct deployment and QCDB instance.
The standard for the log_facility is: <application_name>/<file>
The standard for the log_facility is: <application_name>/<service>
Note: The
<service>
portion should be a descriptive name for the service, module, or controller (e.g.,bkp-service
,obj-controller
). This helps make logs more readable and traceable. Avoid using generic filenames; prefer meaningful service names as shown in the examples below.Setting the Log Facility
The log facility string should be built using the process.env.npm_config_log_label
environment variable. If not set, a sensible default (e.g., qcg
) should be used.
import { LogManager } from '@aliceo2/web-ui';
// Use the environment variable or a default value
const LOG_FACILITY = `${process.env.npm_config_log_label ?? 'qcg'}/bkp-service`;
// Initialize the logger for this service
this._logger = LogManager.getLogger(LOG_FACILITY);
// Usage example
this._logger.infoMessage('BookkeepingService started');
console.log
or other logging libraries directly.