]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5253] Logging information is now written in config-write.
authorTomek Mrugalski <tomasz@isc.org>
Wed, 26 Apr 2017 13:03:39 +0000 (15:03 +0200)
committerWlodek Wencel <wlodek@isc.org>
Wed, 26 Apr 2017 18:51:34 +0000 (20:51 +0200)
Conflicts:
src/lib/process/d_controller.cc

src/lib/process/d_controller.cc

index b3254046388468b8fa0c6937dbaaa06a6f1d622c..ac7a8df5027f28c8f9d6cc193333059ce7a208ee 100644 (file)
@@ -448,6 +448,28 @@ DControllerBase::configWriteHandler(const std::string&,
 
     // Ok, it's time to write the file.
     size_t size = 0;
+    ElementPtr cfg = process_->getCfgMgr()->getContext()->toElement();
+
+    // Logging storage is messed up in CA. During its configuration (see
+    // DControllerBase::configFromFile() it calls Daemon::configureLogger()
+    // that stores the logging info in isc::dhcp::CfgMgr::getStagingCfg().
+    // This is later moved to getCurrentCfg() when the configuration is
+    // commited. All control-agent specific configuration is stored in
+    // a structure accessible by process_->getCfgMgr()->getContext(). Note
+    // logging information is not stored there.
+    //
+    // As a result, we need to extract the CA configuration from one
+    // place and logging from another.
+    ConstElementPtr loginfo = isc::dhcp::CfgMgr::instance().getCurrentCfg()->toElement();
+    if (loginfo) {
+        // If there was a config stored in dhcp::CfgMgr, try to get Logging info from it.
+        loginfo = loginfo->get("Logging");
+    }
+    if (loginfo) {
+        // If there is some logging information, add it to our config.
+        cfg->set("Logging", loginfo);
+    }
+
     try {
         size = writeConfigFile(filename);
     } catch (const isc::Exception& ex) {