From 070672ba4ed951842a3dd19b965cf0be14f35d4d Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Thu, 1 Dec 2016 13:43:58 +0100 Subject: [PATCH] [5074] Rename d2_logger to dctl_logger in libkea-process. --- doc/guide/logging.xml | 12 ++++++--- src/bin/d2/d2_log.cc | 4 +-- src/bin/d2/d2_log.h | 2 +- src/bin/d2/d2_process.cc | 30 +++++++++++------------ src/bin/d2/d2_queue_mgr.cc | 6 ++--- src/lib/process/Makefile.am | 6 ++--- src/lib/process/d_cfg_mgr.cc | 2 +- src/lib/process/d_controller.cc | 2 +- src/lib/process/d_controller.h | 2 +- src/lib/process/{d2_log.cc => d_log.cc} | 4 +-- src/lib/process/{d2_log.h => d_log.h} | 0 src/lib/process/io_service_signal.cc | 2 +- src/lib/process/tests/run_unittests.cc | 2 +- src/lib/process/testutils/d_test_stubs.cc | 2 +- 14 files changed, 41 insertions(+), 35 deletions(-) rename src/lib/process/{d2_log.cc => d_log.cc} (87%) rename src/lib/process/{d2_log.h => d_log.h} (100%) diff --git a/doc/guide/logging.xml b/doc/guide/logging.xml index 3a260a3874..24f9bbea7a 100644 --- a/doc/guide/logging.xml +++ b/doc/guide/logging.xml @@ -439,12 +439,18 @@ + + + kea-dhcp-ddns.dctl - the logger used by the + kea-dhcp-ddns daemon for logging basic information about the + process, received signals and triggered reconfigurations. + + + kea-dhcp-ddns.dhcpddns - the logger used by the - kea-dhcp-ddns daemon for logging configuration and global event - information. This logger does not specify logging settings for - libraries used by the daemon. + kea-dhcp-ddns daemon for logging events related to DDNS operations. diff --git a/src/bin/d2/d2_log.cc b/src/bin/d2/d2_log.cc index daadcf4118..1b292a7b61 100644 --- a/src/bin/d2/d2_log.cc +++ b/src/bin/d2/d2_log.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -12,7 +12,7 @@ namespace isc { namespace d2 { /// @brief Defines the logger used within D2. -isc::log::Logger dctl_logger("dhcpddns"); +isc::log::Logger d2_logger("dhcpddns"); isc::log::Logger dhcp_to_d2_logger("dhcp-to-d2"); isc::log::Logger d2_to_dns_logger("d2-to-dns"); diff --git a/src/bin/d2/d2_log.h b/src/bin/d2/d2_log.h index e6728527c5..2333a0c962 100644 --- a/src/bin/d2/d2_log.h +++ b/src/bin/d2/d2_log.h @@ -15,7 +15,7 @@ namespace isc { namespace d2 { /// Define the loggers for the "d2" logging. -extern isc::log::Logger dctl_logger; +extern isc::log::Logger d2_logger; extern isc::log::Logger dhcp_to_d2_logger; extern isc::log::Logger d2_to_dns_logger; diff --git a/src/bin/d2/d2_process.cc b/src/bin/d2/d2_process.cc index bc435e1f03..313296838e 100644 --- a/src/bin/d2/d2_process.cc +++ b/src/bin/d2/d2_process.cc @@ -42,7 +42,7 @@ D2Process::init() { void D2Process::run() { - LOG_INFO(dctl_logger, DHCP_DDNS_STARTED).arg(VERSION); + LOG_INFO(d2_logger, DHCP_DDNS_STARTED).arg(VERSION); // Loop forever until we are allowed to shutdown. while (!canShutdown()) { try { @@ -68,7 +68,7 @@ D2Process::run() { "Primary IO service stopped unexpectedly"); } } catch (const std::exception& ex) { - LOG_FATAL(dctl_logger, DHCP_DDNS_FAILED).arg(ex.what()); + LOG_FATAL(d2_logger, DHCP_DDNS_FAILED).arg(ex.what()); isc_throw (DProcessBaseError, "Process run method failed: " << ex.what()); } @@ -78,7 +78,7 @@ D2Process::run() { // this might be the place to do it, once there is a persistence mgr. // This may also be better in checkQueueStatus. - LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DHCP_DDNS_RUN_EXIT); + LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, DHCP_DDNS_RUN_EXIT); }; @@ -145,7 +145,7 @@ D2Process::canShutdown() const { } if (all_clear) { - LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, + LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, DHCP_DDNS_CLEARED_FOR_SHUTDOWN) .arg(getShutdownTypeStr(shutdown_type_)); } @@ -156,7 +156,7 @@ D2Process::canShutdown() const { isc::data::ConstElementPtr D2Process::shutdown(isc::data::ConstElementPtr args) { - LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DHCP_DDNS_SHUTDOWN_COMMAND) + LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, DHCP_DDNS_SHUTDOWN_COMMAND) .arg(args ? args->str() : "(no arguments)"); // Default shutdown type is normal. @@ -190,7 +190,7 @@ D2Process::shutdown(isc::data::ConstElementPtr args) { isc::data::ConstElementPtr D2Process::configure(isc::data::ConstElementPtr config_set) { - LOG_DEBUG(dctl_logger, DBGLVL_TRACE_BASIC, + LOG_DEBUG(d2_logger, DBGLVL_TRACE_BASIC, DHCP_DDNS_CONFIGURE).arg(config_set->str()); int rcode = 0; @@ -235,7 +235,7 @@ D2Process::checkQueueStatus() { // canceling active listening which may generate an IO event, so // instigate the stop and get out. try { - LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, + LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, DHCP_DDNS_QUEUE_MGR_STOPPING) .arg(reconf_queue_flag_ ? "reconfiguration" : "shutdown"); @@ -243,7 +243,7 @@ D2Process::checkQueueStatus() { } catch (const isc::Exception& ex) { // It is very unlikey that we would experience an error // here, but theoretically possible. - LOG_ERROR(dctl_logger, DHCP_DDNS_QUEUE_MGR_STOP_ERROR) + LOG_ERROR(d2_logger, DHCP_DDNS_QUEUE_MGR_STOP_ERROR) .arg(ex.what()); } } @@ -256,12 +256,12 @@ D2Process::checkQueueStatus() { size_t threshold = (((queue_mgr_->getMaxQueueSize() * QUEUE_RESTART_PERCENT)) / 100); if (queue_mgr_->getQueueSize() <= threshold) { - LOG_INFO (dctl_logger, DHCP_DDNS_QUEUE_MGR_RESUMING) + LOG_INFO (d2_logger, DHCP_DDNS_QUEUE_MGR_RESUMING) .arg(threshold).arg(queue_mgr_->getMaxQueueSize()); try { queue_mgr_->startListening(); } catch (const isc::Exception& ex) { - LOG_ERROR(dctl_logger, DHCP_DDNS_QUEUE_MGR_RESUME_ERROR) + LOG_ERROR(d2_logger, DHCP_DDNS_QUEUE_MGR_RESUME_ERROR) .arg(ex.what()); } } @@ -278,7 +278,7 @@ D2Process::checkQueueStatus() { // to keep from endlessly retrying over and over, with little time // in between. if (!shouldShutdown()) { - LOG_INFO (dctl_logger, DHCP_DDNS_QUEUE_MGR_RECOVERING); + LOG_INFO (d2_logger, DHCP_DDNS_QUEUE_MGR_RECOVERING); reconfigureQueueMgr(); } break; @@ -295,7 +295,7 @@ D2Process::checkQueueStatus() { // we can do the reconfigure. In other words, we aren't RUNNING or // STOPPING. if (reconf_queue_flag_) { - LOG_DEBUG(dctl_logger, DBGLVL_TRACE_BASIC, + LOG_DEBUG(d2_logger, DBGLVL_TRACE_BASIC, DHCP_DDNS_QUEUE_MGR_RECONFIGURING); reconfigureQueueMgr(); } @@ -326,7 +326,7 @@ D2Process::reconfigureQueueMgr() { /// @todo Remove this once we provide a secure mechanism. std::string ip_address = d2_params->getIpAddress().toText(); if (ip_address != "127.0.0.1" && ip_address != "::1") { - LOG_WARN(dctl_logger, DHCP_DDNS_NOT_ON_LOOPBACK).arg(ip_address); + LOG_WARN(d2_logger, DHCP_DDNS_NOT_ON_LOOPBACK).arg(ip_address); } // Instantiate the listener. @@ -350,7 +350,7 @@ D2Process::reconfigureQueueMgr() { // Queue manager failed to initialize and therefore not listening. // This is most likely due to an unavailable IP address or port, // which is a configuration issue. - LOG_ERROR(dctl_logger, DHCP_DDNS_QUEUE_MGR_START_ERROR).arg(ex.what()); + LOG_ERROR(d2_logger, DHCP_DDNS_QUEUE_MGR_START_ERROR).arg(ex.what()); } } @@ -360,7 +360,7 @@ D2Process::command(const std::string& command, // @todo This is the initial implementation. If and when D2 is extended // to support its own commands, this implementation must change. Otherwise // it should reject all commands as it does now. - LOG_DEBUG(dctl_logger, DBGLVL_TRACE_BASIC, DHCP_DDNS_COMMAND) + LOG_DEBUG(d2_logger, DBGLVL_TRACE_BASIC, DHCP_DDNS_COMMAND) .arg(command).arg(args ? args->str() : "(no args)"); return (isc::config::createAnswer(COMMAND_INVALID, "Unrecognized command: " diff --git a/src/bin/d2/d2_queue_mgr.cc b/src/bin/d2/d2_queue_mgr.cc index 15ea96e04e..ba9676df71 100644 --- a/src/bin/d2/d2_queue_mgr.cc +++ b/src/bin/d2/d2_queue_mgr.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -137,7 +137,7 @@ D2QueueMgr::startListening() { << ex.what()); } - LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, DHCP_DDNS_QUEUE_MGR_STARTED); + LOG_DEBUG(d2_logger, DBGLVL_START_SHUT, DHCP_DDNS_QUEUE_MGR_STARTED); } void @@ -172,7 +172,7 @@ D2QueueMgr::stopListening(const State target_stop_state) { void D2QueueMgr::updateStopState() { mgr_state_ = target_stop_state_; - LOG_DEBUG(dctl_logger, DBGLVL_TRACE_BASIC, DHCP_DDNS_QUEUE_MGR_STOPPED); + LOG_DEBUG(d2_logger, DBGLVL_TRACE_BASIC, DHCP_DDNS_QUEUE_MGR_STOPPED); } diff --git a/src/lib/process/Makefile.am b/src/lib/process/Makefile.am index 04eb4a30b9..58a3639e80 100644 --- a/src/lib/process/Makefile.am +++ b/src/lib/process/Makefile.am @@ -36,9 +36,9 @@ EXTRA_DIST = process_messages.mes CLEANFILES = *.gcno *.gcda spec_config.h process_messages.h process_messages.cc s-messages lib_LTLIBRARIES = libkea-process.la -libkea_process_la_SOURCES = d2_log.cc d2_log.h -libkea_process_la_SOURCES += d_cfg_mgr.cc d_cfg_mgr.h +libkea_process_la_SOURCES = d_cfg_mgr.cc d_cfg_mgr.h libkea_process_la_SOURCES += d_controller.cc d_controller.h +libkea_process_la_SOURCES += d_log.cc d_log.h libkea_process_la_SOURCES += d_process.h libkea_process_la_SOURCES += io_service_signal.cc io_service_signal.h @@ -65,7 +65,7 @@ libkea_process_la_LIBADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) $(BOOST_LIBS) # Specify the headers for copying into the installation directory tree. libkea_process_includedir = $(pkgincludedir)/process libkea_process_include_HEADERS = \ - d2_log.h \ + d_log.h \ d_cfg_mgr.h \ d_controller.h \ d_process.h \ diff --git a/src/lib/process/d_cfg_mgr.cc b/src/lib/process/d_cfg_mgr.cc index b401512369..478d9b597e 100644 --- a/src/lib/process/d_cfg_mgr.cc +++ b/src/lib/process/d_cfg_mgr.cc @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/lib/process/d_controller.cc b/src/lib/process/d_controller.cc index a775babf61..53ccc31142 100644 --- a/src/lib/process/d_controller.cc +++ b/src/lib/process/d_controller.cc @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #ifdef HAVE_MYSQL diff --git a/src/lib/process/d_controller.h b/src/lib/process/d_controller.h index 071ab7a29f..92a8001461 100644 --- a/src/lib/process/d_controller.h +++ b/src/lib/process/d_controller.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/lib/process/d2_log.cc b/src/lib/process/d_log.cc similarity index 87% rename from src/lib/process/d2_log.cc rename to src/lib/process/d_log.cc index 456b84c0fd..06eec6e35e 100644 --- a/src/lib/process/d2_log.cc +++ b/src/lib/process/d_log.cc @@ -6,13 +6,13 @@ /// Defines the logger used by the top-level component of kea-dhcp-ddns. -#include +#include namespace isc { namespace d2 { /// @brief Defines the logger used within libkea-process library. -isc::log::Logger dctl_logger("dhcpddns"); +isc::log::Logger dctl_logger("dctl"); } // namespace d2 } // namespace isc diff --git a/src/lib/process/d2_log.h b/src/lib/process/d_log.h similarity index 100% rename from src/lib/process/d2_log.h rename to src/lib/process/d_log.h diff --git a/src/lib/process/io_service_signal.cc b/src/lib/process/io_service_signal.cc index 98c3309fb3..04b0609b74 100644 --- a/src/lib/process/io_service_signal.cc +++ b/src/lib/process/io_service_signal.cc @@ -5,7 +5,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include -#include +#include #include namespace isc { diff --git a/src/lib/process/tests/run_unittests.cc b/src/lib/process/tests/run_unittests.cc index eb910ae29b..e970ed5d68 100644 --- a/src/lib/process/tests/run_unittests.cc +++ b/src/lib/process/tests/run_unittests.cc @@ -5,7 +5,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include -#include +#include #include int diff --git a/src/lib/process/testutils/d_test_stubs.cc b/src/lib/process/testutils/d_test_stubs.cc index 2fa9171c85..e1e8ea7599 100644 --- a/src/lib/process/testutils/d_test_stubs.cc +++ b/src/lib/process/testutils/d_test_stubs.cc @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include