]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Initialize logging before reading configuration
authorAndrei Pavel <andrei.pavel@qualitance.com>
Wed, 14 Dec 2016 14:56:02 +0000 (16:56 +0200)
committerAndrei Pavel <andrei.pavel@qualitance.com>
Wed, 14 Dec 2016 14:56:02 +0000 (16:56 +0200)
More precisely, before reading the "Dhcp4" and "Dhcp6" configurations to
log errors thrown because of any configuration loading issues.

src/bin/dhcp4/kea_controller.cc
src/bin/dhcp6/kea_controller.cc

index 102691cc3b3b2452a0adfa97b415447a43d6c8ac..4f68ffb062bf52913607d3aa4837667487c7504a 100644 (file)
@@ -73,6 +73,11 @@ void configure(const std::string& file_name) {
         Daemon::configureLogger(json->get("Logging"),
                                 CfgMgr::instance().getStagingCfg());
 
+        // Apply the new logger configuration to log4cplus. It is done before
+        // commit in case something goes wrong and before configuration load
+        // in order to log possible configuration problems.
+        CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
+
         // Get Dhcp4 component from the config
         dhcp4 = json->get("Dhcp4");
         if (!dhcp4) {
@@ -101,11 +106,6 @@ void configure(const std::string& file_name) {
             isc_throw(isc::BadValue, reason);
         }
 
-        // If configuration was parsed successfully, apply the new logger
-        // configuration to log4cplus. It is done before commit in case
-        // something goes wrong.
-        CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
-
         // Use new configuration.
         /// @todo: This commit should be moved to
         /// CtrlDhcp4Srv::commandConfigReloadHandler.
index 62be83af99093998e6305295489b58453f789eea..cb46299c15b63d5e14831f9380e9ce899caf6422 100644 (file)
@@ -81,6 +81,11 @@ void configure(const std::string& file_name) {
         Daemon::configureLogger(json->get("Logging"),
                                 CfgMgr::instance().getStagingCfg());
 
+        // Apply the new logger configuration to log4cplus. It is done before
+        // commit in case something goes wrong and before configuration load
+        // in order to log possible configuration problems.
+        CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
+
         // Get Dhcp6 component from the config
         dhcp6 = json->get("Dhcp6");
 
@@ -110,11 +115,6 @@ void configure(const std::string& file_name) {
             isc_throw(isc::BadValue, reason);
         }
 
-        // If configuration was parsed successfully, apply the new logger
-        // configuration to log4cplus. It is done before commit in case
-        // something goes wrong.
-        CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
-
         // Use new configuration.
         CfgMgr::instance().commit();