diff options
author | Jelte Jansen <jelte@isc.org> | 2011-06-27 18:02:30 +0200 |
---|---|---|
committer | Jelte Jansen <jelte@isc.org> | 2011-06-27 18:02:30 +0200 |
commit | d6cddde949ca816c12c182066afd5057eb726b86 (patch) | |
tree | 87358db5c94a62ab048bf0d2f7bed03233c0ca67 | |
parent | Merge branch 'master' of git+ssh://bind10.isc.org/var/bind10/git/bind10 (diff) | |
download | kea-d6cddde949ca816c12c182066afd5057eb726b86.tar.xz kea-d6cddde949ca816c12c182066afd5057eb726b86.zip |
[trac759] init logger new style
-rwxr-xr-x | src/bin/cfgmgr/b10-cfgmgr.py.in | 4 | ||||
-rw-r--r-- | src/lib/python/isc/config/cfgmgr.py | 24 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/bin/cfgmgr/b10-cfgmgr.py.in b/src/bin/cfgmgr/b10-cfgmgr.py.in index d91dfca764..ffb27f4324 100755 --- a/src/bin/cfgmgr/b10-cfgmgr.py.in +++ b/src/bin/cfgmgr/b10-cfgmgr.py.in @@ -17,7 +17,6 @@ import sys; sys.path.append ('@@PYTHONPATH@@') -from isc.config.cfgmgr import ConfigManager, ConfigManagerDataReadError import bind10_config from isc.cc import SessionError import isc.util.process @@ -26,6 +25,9 @@ import os from optparse import OptionParser import glob import os.path +import isc.log +isc.log.init("b10-cfgmgr") +from isc.config.cfgmgr import ConfigManager, ConfigManagerDataReadError, logger isc.util.process.rename() diff --git a/src/lib/python/isc/config/cfgmgr.py b/src/lib/python/isc/config/cfgmgr.py index f46daf8bfb..d54dbc2b82 100644 --- a/src/lib/python/isc/config/cfgmgr.py +++ b/src/lib/python/isc/config/cfgmgr.py @@ -28,7 +28,12 @@ import tempfile import json import errno from isc.cc import data -from isc.config import ccsession, config_data +from isc.config import ccsession, config_data, module_spec +from isc.util.file import path_search +import bind10_config +import isc.log + +logger = isc.log.Logger("cfgmgr") class ConfigManagerDataReadError(Exception): """This exception is thrown when there is an error while reading @@ -182,6 +187,20 @@ class ConfigManager: self.cc.group_subscribe("ConfigManager") self.cc.group_subscribe("Boss", "ConfigManager") self.running = False + # As a core module, CfgMgr is different than other modules, + # as it does not use a ModuleCCSession, and hence needs + # to handle logging config on its own + self.log_config_data = config_data.ConfigData( + isc.config.module_spec_from_file( + path_search('logging.spec', + bind10_config.PLUGIN_PATHS))) + # store the logging 'module' name for easier reference + self.log_module_name = self.log_config_data.get_module_spec().get_module_name() + + def check_logging_config(self, config): + if self.log_module_name in config: + ccsession.default_logconfig_handler(config[self.log_module_name], + self.log_config_data) def notify_boss(self): """Notifies the Boss module that the Config Manager is running""" @@ -256,6 +275,7 @@ class ConfigManager: self.config = ConfigManagerData.read_from_file(self.data_path, self.\ database_filename) + self.check_logging_config(self.config.data); except ConfigManagerDataEmpty: # ok, just start with an empty config self.config = ConfigManagerData(self.data_path, @@ -388,6 +408,8 @@ class ConfigManager: got_error = True err_list.append(val) if not got_error: + # if Logging config is in there, update our config as well + self.check_logging_config(cmd); self.write_config() return ccsession.create_answer(0) else: |