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_sections(→ Dict[str, Any])

Merge logconfig section overrides into base configuration.

load_logconfig_with_overrides(→ Dict[str, Any])

Load logconfig with support for user overrides from JobmonConfig.

configure_logging_with_overrides(→ None)

Configure logging with template and override support.

get_logconfig_examples(→ Dict[str, Dict[str, Any]])

Get example configurations for documentation and testing.

configure_component_logging(→ None)

Configure logging for jobmon components using existing override system.

_get_component_template_path(→ str)

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