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.

The primary configuration is generated programmatically via generate_component_logconfig(), with support for file-based and section-based overrides from JobmonConfig.

Attributes

SHARED_FORMATTERS

Functions

generate_component_logconfig(→ Dict[str, Any])

Generate a logconfig dictionary for a jobmon component.

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.

Module Contents

core.config.logconfig_utils.SHARED_FORMATTERS: Dict[str, Any]
core.config.logconfig_utils.generate_component_logconfig(component: str, log_level: str = 'INFO', console_level: str = 'INFO', otlp_level: str = 'DEBUG', disable_existing_loggers: bool = False, include_core_logger: bool = True) Dict[str, Any]

Generate a logconfig dictionary for a jobmon component.

This is the single source of truth for component logging configuration. All component logconfigs share the same structure, differing only in the logger namespace and optional settings.

Parameters:
  • component – Component name (‘client’, ‘distributor’, ‘worker’, ‘server’)

  • log_level – Log level for the component’s primary logger

  • console_level – Log level for console handler

  • otlp_level – Log level for OTLP handler

  • disable_existing_loggers – Whether to disable existing loggers

  • include_core_logger – Whether to include a jobmon.core logger

Returns:

Complete logconfig dictionary ready for logging.config.dictConfig()

Example

>>> config = generate_component_logconfig("distributor", log_level="DEBUG")
>>> logging.config.dictConfig(config)
core.config.logconfig_utils.merge_logconfig_sections(base_config: Dict[str, Any], overrides: Dict[str, Any]) Dict[str, Any]

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]

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

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]]

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

Configure logging for jobmon components.

Uses programmatic configuration as the base, with support for file-based and section-based overrides from JobmonConfig.

Configuration precedence: 1. File override: logging.{component}_logconfig_file (complete replacement) 2. Section override: logging.{component}.* (merged with base) 3. Programmatic base: generate_component_logconfig()

Parameters:

component_name – Component name (‘client’, ‘distributor’, ‘worker’, ‘server’)