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
Functions
|
Ensure structlog is configured for Jobmon, using lazy initialization. |
|
Configure client logging with template and user override support. |
|
Keep only Jobmon OTLP handlers when host renders output directly. |
Configure logging for direct-rendering hosts while preserving telemetry. |
|
|
Attach OTLP handlers if jobmon loggers ended up without handlers. |
Module Contents
- client.logging._DEFAULT_LOG_FORMAT = '%(asctime)s [%(name)-12s] %(module)s %(levelname)-8s: %(message)s'[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.