blackbricksoftware / civicrm-container-logs
Write CiviCRM Logs to stderr. Useful for running CiviCRM inside a Docker container.
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:civicrm-ext
Requires
- php: ^8.1
- monolog/monolog: ^3.9
This package is auto-updated.
Last update: 2025-08-09 06:25:43 UTC
README
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.
Features
- Redirects all CiviCRM logs to
stderr
- Simplifies log management in containerized environments
Usage
- 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.
Configuration
Log Level Configuration
You can control the minimum log level emitted by this extension using the CIVICRM_CONTAINER_LOGS_LEVEL
constant. Set this constant in your environment or configuration to filter logs according to severity. The log level defaults to debug
;
This constant accepts any value supported by \Monolog\Level
. Monolog supports the logging levels described by RFC 5424.
- DEBUG (100): Detailed debug information.
- INFO (200): Interesting events. Examples: User logs in, SQL logs.
- NOTICE (250): Normal but significant events.
- WARNING (300): Exceptional occurrences that are not errors. Examples: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
- ERROR (400): Runtime errors that do not require immediate action but should typically be logged and monitored.
- CRITICAL (500): Critical conditions. Example: Application component unavailable, unexpected exception.
- ALERT (550): Action must be taken immediately. Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
- EMERGENCY (600): Emergency: system is unusable.
Example usage:
define('CIVICRM_CONTAINER_LOGS_LEVEL', 'warning');
This will ensure only warnings and more severe messages are logged.
Requirements
- PHP8.1 or newer
- CiviCRM installation
- Docker container environment (recommended)