Install & Compatibility
Where this runs
tested against v1.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 25.7MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 3.2s · import 0.000s · 27MB
24MB installed
● package 24MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
hydra_colorlog
✓ # hydra-colorlog is typically enabled via Hydra's configuration, not direct Python import.
Users enable the plugin by configuring Hydra's defaults, rather than importing Python symbols from hydra_colorlog directly into their application code.
ColoredFormatter
✓ from colorlog import ColoredFormatter
While 'colorlog.ColoredFormatter' is used internally by the plugin, direct import is only necessary if you're customizing log formats beyond the plugin's defaults.
To enable `hydra-colorlog`, install the package and then create a Hydra configuration file (e.g., `config.yaml` in a `conf` directory) that overrides the default Hydra logging settings. This minimal example demonstrates how to set up a Hydra application and activate colored logging by explicitly specifying `colorlog` for both `hydra/job_logging` and `hydra/hydra_logging` in the defaults list.
import hydra
from omegaconf import DictConfig
import logging
log = logging.getLogger(__name__)
@hydra.main(config_path="conf", config_name="config", version_base="1.2")
def my_app(cfg: DictConfig) -> None:
log.info("This is an info message.")
log.warning("This is a warning message.")
log.error("This is an error message.")
print(f"Config: {cfg.pretty()}")
if __name__ == "__main__":
# Create a 'conf' directory and 'config.yaml' file alongside this script.
# In config.yaml, add:
# defaults:
# - override hydra/job_logging: colorlog
# - override hydra/hydra_logging: colorlog
# Example to run: python your_script_name.py
my_app()
Debug
Known issues
breakingWhen using older Hydra 1.0.x with OmegaConf 2.1, attempting to load `hydra/hydra_logging/colorlog` could result in a `MissingConfigException`. This often indicates an incompatibility between the specific minor versions of Hydra and OmegaConf.fixUpgrade `hydra-core` to at least 1.0.5 or ensure your `hydra-colorlog` version is compatible with your `hydra-core` and `omegaconf` versions. Check the `hydra-colorlog` PyPI page for required dependencies.
affects: Hydra < 1.0.5, possibly specific combinations with OmegaConf 2.1
gotchaFor `hydra-colorlog` to function, you must explicitly override `hydra/job_logging` and `hydra/hydra_logging` to `colorlog` within your Hydra configuration's `defaults` list. Without this configuration, the plugin will not be active, and you will not see colored output.fixAdd the following to your main Hydra config file (e.g., `config.yaml`):
```yaml
defaults:
- override hydra/job_logging: colorlog
- override hydra/hydra_logging: colorlog
```
affects: All versions
deprecatedDocumentation for older Hydra versions (e.g., 1.0, 1.2) explicitly states they are 'no longer actively maintained'. While `hydra-colorlog` 1.2.0 works with Hydra 1.x, users should target newer Hydra documentation and versions for active support and features.fixConsider upgrading to the latest stable version of Hydra (e.g., 1.3.x or newer if available) to benefit from continued maintenance, bug fixes, and new features. Ensure `hydra-colorlog` is compatible with the target Hydra version.
affects: Hydra 1.0.x, 1.1.x, 1.2.x
gotchaOlder versions of Hydra (specifically around 1.1.0/1.1.1) had a bug where enabling the `colorlog` override could inadvertently disable other logging overrides, leading to unexpected logging behavior.fixEnsure you are using a patched version of Hydra 1.1.x (e.g., 1.1.2 or later) or upgrade to Hydra 1.2.0+ where this issue should be resolved.
affects: Hydra 1.1.0, 1.1.1 (fixed in later bugfix releases)
Errors
Common errors & fixes
MissingConfigException: Could not load hydra/hydra_logging/colorlog
This error occurs when Hydra cannot find the `colorlog` configuration for its logging defaults, typically because the `hydra-colorlog` plugin is installed but not correctly enabled in the Hydra configuration files.
fixAdd the necessary overrides to your main Hydra config file (e.g., `config.yaml`) within the `defaults` section to explicitly enable `colorlog` for both `hydra/job_logging` and `hydra/hydra_logging`.
```yaml
defaults:
- override hydra/job_logging: colorlog
- override hydra/hydra_logging: colorlog
```
ModuleNotFoundError: No module named 'colorlog'
The `hydra-colorlog` plugin depends on the `colorlog` library, but this error indicates that the `colorlog` package itself has not been installed in your Python environment.
fixInstall the `colorlog` package using pip.
```bash
pip install colorlog
```
hydra-colorlog not showing colors
Colored logging output is not appearing because the `hydra-colorlog` plugin, despite being installed, is not activated or configured correctly within your Hydra application's `defaults`.
fixEnsure that `hydra-colorlog` is installed and that your Hydra configuration explicitly overrides `hydra/job_logging` and `hydra/hydra_logging` to `colorlog` in the `defaults` list.
```yaml
defaults:
- override hydra/job_logging: colorlog
- override hydra/hydra_logging: colorlog
```
hydra-colorlog log file in wrong directory
Enabling the `hydra-colorlog` plugin can sometimes inadvertently alter the default log file output directory, causing log files to be generated in the current working directory instead of Hydra's designated output directory.
fixThis was a known bug in older Hydra versions (e.g., 1.1.0/1.1.1) and might require updating the internal colorlog configuration to correctly handle the log file path. Ensure you are using a patched version of Hydra (e.g., 1.1.2 or later) or upgrade to Hydra 1.2.0+ where this issue should be resolved.
Upgrade
Version history
1.2.0latest on PyPI · released May 17, 2022
Audit
Dependencies
hydra-corerequiredRequired for Hydra application integration (plugin).
colorlogrequiredProvides the colored logging functionality.