我未能成功禁用 kedro 日志。我尝试将 disable_existing_loggers: True
添加到logging.yml 文件,并将disable:True
添加到所有现有日志,但它似乎仍然在保存日志文件。有什么建议吗?
最佳答案
如果你想要kedro
要停止记录,您可以覆盖 _setup_logging
在ProjectContext
在src/<package-name>/run.py
根据documentation 。例如:
class ProjectContext(KedroContext):
"""Users can override the remaining methods from the parent class here, or create new ones
(e.g. as required by plugins)
"""
project_name = "<PACKGE-NAME>"
project_version = "0.15.4"
def _get_pipelines(self) -> Dict[str, Pipeline]:
return create_pipelines()
def _setup_logging(self) -> None:
import logging
logging.disable()
如果您希望它仍然登录到控制台,但不保存到 logs/info.log
那么你可以做def _setup_logging(self) -> None: pass
.
关于python - 如何禁用 Kedro 中的日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58751122/