def setup_logging(filename):
"""Setup logging based on a json string.
:type filename: str
:param filename: Log configuration file.
:raises: IOError -- If the file does not exist.
:raises: ValueError -- If the file is an invalid json file.
"""
try:
config = parse_json_file(filename)
log_conf.dictConfig(config)
logpy4j = logging.getLogger("py4j")
logpy4j.setLevel(logging.ERROR)
logkafka = logging.getLogger("kafka")
logkafka.setLevel(logging.ERROR)
except (IOError, ValueError):
raise
评论列表
文章目录