This extension replaces the default CiviCRM log channels to send all logs to stderr (currently). This is especially useful when running CiviCRM inside a Docker container, as it allows logs to be consolidated and managed by the container runtime.
- Redirects all CiviCRM logs to
stderr - Simplifies log management in containerized environments
- Install the extension in your CiviCRM installation.
- Enable the extension from the CiviCRM admin interface.
- Logs will now appear in the container's standard error output.
The minimum log level can be set three ways, highest precedence first:
- PHP constant in
civicrm.settings.php:define('CIVICRM_CONTAINER_LOGS_LEVEL', 'warning'); - Environment variable (recommended for containerised deployments):
CIVICRM_CONTAINER_LOGS_LEVEL=warning— picked up natively by CiviCRM'sSettingsManagerbecause the setting metadata declaresis_env_loadable: TRUE,global_name: 'CIVICRM_CONTAINER_LOGS_LEVEL'. $civicrm_settingincivicrm.settings.php:$civicrm_setting['domain']['container_logs_level'] = 'warning';
The setting is declared is_constant: TRUE, so attempts to write via
Civi::settings()->set(...) / the API / the admin UI are rejected with
a helpful error pointing to the three supported sources above.
Default: debug (everything passes through).
Accepted values are any Monolog level name (see \Monolog\Level; values from RFC 5424):
- DEBUG (100), INFO (200), NOTICE (250), WARNING (300),
- ERROR (400), CRITICAL (500), ALERT (550), EMERGENCY (600).
- PHP8.1 or newer
- CiviCRM installation
- Docker container environment (recommended)