client.logging

Logging configuration for jobmon client applications.

This module provides the standard logging configuration used by workflow.run(configure_logging=True).

The module supports both legacy dict-based configs and new template-based configurations. Requester logs are automatically captured by OTLP when enabled (handled by the Requester class itself).

Attributes

_structlog_configured_lock

_structlog_configured_by_jobmon

_DEFAULT_LOG_FORMAT

default_config

Functions

ensure_structlog_configured(→ None)

Ensure structlog is configured for Jobmon, using lazy initialization.

configure_client_logging(→ None)

Configure client logging with template and user override support.

_remove_non_jobmon_handlers(→ List[str])

Keep only Jobmon OTLP handlers when host renders output directly.

_configure_client_logging_for_direct_rendering(→ None)

Configure logging for direct-rendering hosts while preserving telemetry.

_ensure_jobmon_otlp_handlers(→ List[str])

Attach OTLP handlers if jobmon loggers ended up without handlers.

Module Contents

client.logging._structlog_configured_lock[source]
client.logging._structlog_configured_by_jobmon = False[source]
client.logging._DEFAULT_LOG_FORMAT = '%(asctime)s [%(name)-12s] %(module)s %(levelname)-8s: %(message)s'[source]
client.logging.default_config: Dict[source]
client.logging.ensure_structlog_configured() None[source]

Ensure structlog is configured for Jobmon, using lazy initialization.

This function is called at the start of key Jobmon operations (workflow.run(), workflow.bind(), etc.) to ensure structlog is configured. It uses a lock to ensure thread-safe initialization.

Behavior: - If host has already configured structlog: prepend Jobmon processors - If structlog is unconfigured: configure it with Jobmon defaults - If already called: no-op (idempotent)

This lazy approach ensures host applications always have the opportunity to configure structlog first, eliminating import-order dependencies.

client.logging.configure_client_logging() None[source]

Configure client logging with template and user override support.

This is the primary interface for configuring client logging. It supports: 1. Default template-based configuration 2. User file overrides via logging.client_logconfig_file 3. User section overrides via logging.client.* 4. Environment variable overrides

Configuration precedence: 1. Custom file (logging.client_logconfig_file) 2. Section overrides (logging.client.formatters/handlers/loggers) 3. Default template (logconfig_client.yaml) 4. Basic fallback configuration

Adapts to host application logging architecture: - If host uses direct rendering (like FHS): sets up minimal stdlib handlers

that pass through formatted output without double-processing

  • If host uses stdlib integration: sets up full Jobmon logging configuration

Note: Requester OTLP is handled separately by the Requester class.

client.logging._remove_non_jobmon_handlers(logconfig: Dict) List[str][source]

Keep only Jobmon OTLP handlers when host renders output directly.

client.logging._configure_client_logging_for_direct_rendering(*, default_template_path: str, logger_factory: Any, wrapper_class: Any) None[source]

Configure logging for direct-rendering hosts while preserving telemetry.

client.logging._ensure_jobmon_otlp_handlers(logconfig_data: Dict[str, Any], jobmon_logger_names: Iterable[str] | None = None) List[str][source]

Attach OTLP handlers if jobmon loggers ended up without handlers.