configure_pylog_MDC¶
- lsst.log.configure_pylog_MDC(level: str, MDC_class: ~typing.Optional[type] = <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.LogRecord
as anMDC
attribute. Any dictionary ordefaultdict
-like class can be used as a type. IfNone
thelogging.LogRecord
will not be augmented.
- level
Notes
This method does two things:
Configures log4cxx with a given logging level and a
PyLogAppender
appender class which forwards all messages to Pythonlogging
.Installs a record factory for Python
logging
that addsMDC
attribute to everylogging.LogRecord
object (instance ofMDC_class
). This will happen by default but can be disabled by setting theMDC_class
parameter toNone
.