Merge "Allow loading logging config from yaml" into feature/zuulv3
diff --git a/zuul/cmd/__init__.py b/zuul/cmd/__init__.py
index 3102f3b..9fa4c03 100644
--- a/zuul/cmd/__init__.py
+++ b/zuul/cmd/__init__.py
@@ -24,6 +24,7 @@
import sys
import traceback
+import yaml
yappi = extras.try_import('yappi')
import zuul.lib.connections
@@ -86,7 +87,14 @@
if not os.path.exists(fp):
raise Exception("Unable to read logging config file at %s" %
fp)
- logging.config.fileConfig(fp)
+
+ if os.path.splitext(fp)[1] in ('.yml', '.yaml'):
+ with open(fp, 'r') as f:
+ logging.config.dictConfig(yaml.safe_load(f))
+
+ else:
+ logging.config.fileConfig(fp)
+
else:
logging.basicConfig(level=logging.DEBUG)