configure_pylog_MDC¶
- lsst.log.configure_pylog_MDC(level: str, MDC_class: type | None = <class 'lsst.log.log.logContinued.MDCDict'>)¶
Configure log4cxx to send messages to Python logging, with MDC support.
- Parameters:
- level
str Name of the logging level for root log4cxx logger.
- MDC_class
type, optional Type of dictionary which is added to
logging.LogRecordas anMDCattribute. Any dictionary ordefaultdict-like class can be used as a type. IfNonethelogging.LogRecordwill not be augmented.
- level
Notes
This method does two things:
Configures log4cxx with a given logging level and a
PyLogAppenderappender class which forwards all messages to Pythonlogging.Installs a record factory for Python
loggingthat addsMDCattribute to everylogging.LogRecordobject (instance ofMDC_class). This will happen by default but can be disabled by setting theMDC_classparameter toNone.