core.config.logconfig_utils
Utilities for loading and overriding logging configurations.
This module provides functions to load template-based logconfigs and apply user-specified overrides from JobmonConfig.
Functions
|
Merge logconfig section overrides into base configuration. |
|
Load logconfig with support for user overrides from JobmonConfig. |
|
Configure logging with template and override support. |
|
Get example configurations for documentation and testing. |
|
Configure logging for jobmon components using existing override system. |
|
Get the template path for a component following local package pattern. |
Module Contents
- core.config.logconfig_utils.merge_logconfig_sections(base_config: Dict[str, Any], overrides: Dict[str, Any]) Dict[str, Any][source]
Merge logconfig section overrides into base configuration.
This performs a deep merge, allowing users to override specific formatters, handlers, or loggers while preserving the rest of the base configuration.
- Parameters:
base_config – Base logconfig dictionary (from templates)
overrides – Override sections from JobmonConfig
- Returns:
Merged logconfig dictionary
- core.config.logconfig_utils.load_logconfig_with_overrides(default_template_path: str, config_section: str, config: jobmon.core.configuration.JobmonConfig | None = None) Dict[str, Any][source]
Load logconfig with support for user overrides from JobmonConfig.
Supports two types of overrides: 1. File-based: Custom logconfig file specified in logging.{component}_logconfig_file 2. Section-based: Override specific sections specified in logging.{component}.*
- Parameters:
default_template_path – Path to the default template-based logconfig
config_section – Config section name (‘client’, ‘server’, ‘requester’)
config – JobmonConfig instance (creates default if None)
- Returns:
Fully resolved logconfig dictionary ready for logging.config.dictConfig()
- core.config.logconfig_utils.configure_logging_with_overrides(default_template_path: str, config_section: str, fallback_config: Dict[str, Any] | None = None, config: jobmon.core.configuration.JobmonConfig | None = None) None[source]
Configure logging with template and override support.
This is a convenience function that loads a logconfig with overrides and applies it using logging.config.dictConfig().
- Parameters:
default_template_path – Path to the default template-based logconfig
config_section – Config section name (‘client’, ‘server’, ‘requester’)
fallback_config – Fallback config if template loading fails
config – JobmonConfig instance (creates default if None)
- core.config.logconfig_utils.get_logconfig_examples() Dict[str, Dict[str, Any]][source]
Get example configurations for documentation and testing.
- Returns:
Dictionary of example logconfig override configurations by component
- core.config.logconfig_utils.configure_component_logging(component_name: str) None[source]
Configure logging for jobmon components using existing override system.
This function integrates seamlessly with the existing logging infrastructure and follows the same patterns as configure_client_logging().
Configuration precedence (handled by existing load_logconfig_with_overrides): 1. File override: logging.{component}_logconfig_file 2. Template: logconfig_{component}.yaml 3. Section override: logging.{component}.* 4. No logging: if no configuration found
- Parameters:
component_name – Component name (‘distributor’, ‘worker’, ‘server’)
- core.config.logconfig_utils._get_component_template_path(component_name: str) str[source]
Get the template path for a component following local package pattern.
- Parameters:
component_name – Component name (‘distributor’, ‘worker’, ‘server’)
- Returns:
Path to component’s local logconfig template, or empty string if not found