Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit 2c470a6

Browse files
committed
apply logging configurations
Currently the configurations set at logging_conf aren't being applied Thus, the log file isn't being created as expected This patch applies these configurations
1 parent e4965be commit 2c470a6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

runner_service/configuration.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import yaml
44
import getpass
55
import logging
6+
import logging.config
67

78
logger = logging.getLogger()
89
logger.setLevel(logging.DEBUG)
@@ -80,6 +81,17 @@ def __init__(self, mode='dev'):
8081
self._apply_overrides()
8182

8283
def _apply_local(self):
84+
# apply logging configurations
85+
if os.path.isfile(self.logging_conf):
86+
try:
87+
with open(self.logging_conf, "r") as _cfg:
88+
local_config = yaml.safe_load(_cfg.read())
89+
logging.config.dictConfig(local_config)
90+
global logger
91+
logger = logging.getLogger()
92+
except yaml.YAMLError as exc:
93+
logger.error("ERROR: YAML error in logging configuration "
94+
"file: {}".format(exc))
8395

8496
# apply overrides from configuration settings in /etc/?
8597
logger.info("Analysing local configuration options from "

0 commit comments

Comments
 (0)