{"id":5961,"library":"hydra-colorlog","title":"Hydra Colorlog","description":"Hydra-colorlog is a plugin for the Hydra configuration framework that enables colored logging output for Hydra applications. It specifically integrates the 'colorlog' library into Hydra's internal (`hydra_logging`) and job-specific (`job_logging`) logging mechanisms, enhancing readability. The current version is 1.2.0, and its release cadence is tied to that of the main Hydra project, which sees several updates per year.","status":"active","version":"1.2.0","language":"en","source_language":"en","source_url":"https://github.com/facebookresearch/hydra/","tags":["hydra","logging","colorlog","configuration","plugin"],"install":[{"cmd":"pip install hydra-colorlog","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Required for Hydra application integration (plugin).","package":"hydra-core","optional":false},{"reason":"Provides the colored logging functionality.","package":"colorlog","optional":false}],"imports":[{"note":"Users enable the plugin by configuring Hydra's defaults, rather than importing Python symbols from hydra_colorlog directly into their application code.","symbol":"hydra_colorlog","correct":"# hydra-colorlog is typically enabled via Hydra's configuration, not direct Python import."},{"note":"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.","symbol":"ColoredFormatter","correct":"from colorlog import ColoredFormatter"}],"quickstart":{"code":"import hydra\nfrom omegaconf import DictConfig\nimport logging\n\nlog = logging.getLogger(__name__)\n\n@hydra.main(config_path=\"conf\", config_name=\"config\", version_base=\"1.2\")\ndef my_app(cfg: DictConfig) -> None:\n    log.info(\"This is an info message.\")\n    log.warning(\"This is a warning message.\")\n    log.error(\"This is an error message.\")\n    print(f\"Config: {cfg.pretty()}\")\n\nif __name__ == \"__main__\":\n    # Create a 'conf' directory and 'config.yaml' file alongside this script.\n    # In config.yaml, add:\n    # defaults:\n    #   - override hydra/job_logging: colorlog\n    #   - override hydra/hydra_logging: colorlog\n    # Example to run: python your_script_name.py\n    my_app()","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade `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.","message":"When 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.","severity":"breaking","affected_versions":"Hydra < 1.0.5, possibly specific combinations with OmegaConf 2.1"},{"fix":"Add the following to your main Hydra config file (e.g., `config.yaml`):\n```yaml\ndefaults:\n  - override hydra/job_logging: colorlog\n  - override hydra/hydra_logging: colorlog\n```","message":"For `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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider 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.","message":"Documentation 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.","severity":"deprecated","affected_versions":"Hydra 1.0.x, 1.1.x, 1.2.x"},{"fix":"Ensure 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.","message":"Older 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.","severity":"gotcha","affected_versions":"Hydra 1.1.0, 1.1.1 (fixed in later bugfix releases)"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}