A logging.config.dictConfig() issue in python
python
logging.config.dictConfig()
import logging
from clearml import Task
= {"version":1,
conf_logging "formatters":{
"simple":{
"format":"%(asctime)s - %(name)s - %(levelname)s - %(message)s"}
}
}= Task.init(project_name="test")
t
logging.config.dictConfig(conf_logging)"INFO!")
logging.info("DEBUG!")
logging.debug("WARN!")
logging.warning(print("PRINT!")
With this code block, you will find no print() or logging is sent to ClearML logging Console. Turns out kedro
use logging.config.dictConfig(conf_logging)
as the default and causing this issue.
A quick fix is to add "incremental": True
in the config dict. In the standard documentation, the default is False
, which means the configuration will replace existing one, thus removing the clearml
handlers, and causing the issue I had.
= {"version":1,
conf_logging "incremental": True
"formatters":{
"simple":{
"format":"%(asctime)s - %(name)s - %(levelname)s - %(message)s"}
} }