2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +00:00

[5074] Rename d2_logger to dctl_logger in libkea-process.

This commit is contained in:
Marcin Siodelski
2016-12-01 13:43:58 +01:00
parent db92b54da7
commit 070672ba4e
14 changed files with 41 additions and 35 deletions

View File

@@ -439,12 +439,18 @@
</simpara> </simpara>
</listitem> </listitem>
<listitem>
<simpara>
<command>kea-dhcp-ddns.dctl</command> - the logger used by the
kea-dhcp-ddns daemon for logging basic information about the
process, received signals and triggered reconfigurations.
</simpara>
</listitem>
<listitem> <listitem>
<simpara> <simpara>
<command>kea-dhcp-ddns.dhcpddns</command> - the logger used by the <command>kea-dhcp-ddns.dhcpddns</command> - the logger used by the
kea-dhcp-ddns daemon for logging configuration and global event kea-dhcp-ddns daemon for logging events related to DDNS operations.
information. This logger does not specify logging settings for
libraries used by the daemon.
</simpara> </simpara>
</listitem> </listitem>

View File

@@ -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 // 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 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -12,7 +12,7 @@ namespace isc {
namespace d2 { namespace d2 {
/// @brief Defines the logger used within 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 dhcp_to_d2_logger("dhcp-to-d2");
isc::log::Logger d2_to_dns_logger("d2-to-dns"); isc::log::Logger d2_to_dns_logger("d2-to-dns");

View File

@@ -15,7 +15,7 @@ namespace isc {
namespace d2 { namespace d2 {
/// Define the loggers for the "d2" logging. /// 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 dhcp_to_d2_logger;
extern isc::log::Logger d2_to_dns_logger; extern isc::log::Logger d2_to_dns_logger;

View File

@@ -42,7 +42,7 @@ D2Process::init() {
void void
D2Process::run() { 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. // Loop forever until we are allowed to shutdown.
while (!canShutdown()) { while (!canShutdown()) {
try { try {
@@ -68,7 +68,7 @@ D2Process::run() {
"Primary IO service stopped unexpectedly"); "Primary IO service stopped unexpectedly");
} }
} catch (const std::exception& ex) { } 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, isc_throw (DProcessBaseError,
"Process run method failed: " << ex.what()); "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 might be the place to do it, once there is a persistence mgr.
// This may also be better in checkQueueStatus. // 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) { if (all_clear) {
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, LOG_DEBUG(d2_logger, DBGLVL_START_SHUT,
DHCP_DDNS_CLEARED_FOR_SHUTDOWN) DHCP_DDNS_CLEARED_FOR_SHUTDOWN)
.arg(getShutdownTypeStr(shutdown_type_)); .arg(getShutdownTypeStr(shutdown_type_));
} }
@@ -156,7 +156,7 @@ D2Process::canShutdown() const {
isc::data::ConstElementPtr isc::data::ConstElementPtr
D2Process::shutdown(isc::data::ConstElementPtr args) { 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)"); .arg(args ? args->str() : "(no arguments)");
// Default shutdown type is normal. // Default shutdown type is normal.
@@ -190,7 +190,7 @@ D2Process::shutdown(isc::data::ConstElementPtr args) {
isc::data::ConstElementPtr isc::data::ConstElementPtr
D2Process::configure(isc::data::ConstElementPtr config_set) { 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()); DHCP_DDNS_CONFIGURE).arg(config_set->str());
int rcode = 0; int rcode = 0;
@@ -235,7 +235,7 @@ D2Process::checkQueueStatus() {
// canceling active listening which may generate an IO event, so // canceling active listening which may generate an IO event, so
// instigate the stop and get out. // instigate the stop and get out.
try { try {
LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT, LOG_DEBUG(d2_logger, DBGLVL_START_SHUT,
DHCP_DDNS_QUEUE_MGR_STOPPING) DHCP_DDNS_QUEUE_MGR_STOPPING)
.arg(reconf_queue_flag_ ? "reconfiguration" .arg(reconf_queue_flag_ ? "reconfiguration"
: "shutdown"); : "shutdown");
@@ -243,7 +243,7 @@ D2Process::checkQueueStatus() {
} catch (const isc::Exception& ex) { } catch (const isc::Exception& ex) {
// It is very unlikey that we would experience an error // It is very unlikey that we would experience an error
// here, but theoretically possible. // 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()); .arg(ex.what());
} }
} }
@@ -256,12 +256,12 @@ D2Process::checkQueueStatus() {
size_t threshold = (((queue_mgr_->getMaxQueueSize() size_t threshold = (((queue_mgr_->getMaxQueueSize()
* QUEUE_RESTART_PERCENT)) / 100); * QUEUE_RESTART_PERCENT)) / 100);
if (queue_mgr_->getQueueSize() <= threshold) { 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()); .arg(threshold).arg(queue_mgr_->getMaxQueueSize());
try { try {
queue_mgr_->startListening(); queue_mgr_->startListening();
} catch (const isc::Exception& ex) { } 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()); .arg(ex.what());
} }
} }
@@ -278,7 +278,7 @@ D2Process::checkQueueStatus() {
// to keep from endlessly retrying over and over, with little time // to keep from endlessly retrying over and over, with little time
// in between. // in between.
if (!shouldShutdown()) { if (!shouldShutdown()) {
LOG_INFO (dctl_logger, DHCP_DDNS_QUEUE_MGR_RECOVERING); LOG_INFO (d2_logger, DHCP_DDNS_QUEUE_MGR_RECOVERING);
reconfigureQueueMgr(); reconfigureQueueMgr();
} }
break; break;
@@ -295,7 +295,7 @@ D2Process::checkQueueStatus() {
// we can do the reconfigure. In other words, we aren't RUNNING or // we can do the reconfigure. In other words, we aren't RUNNING or
// STOPPING. // STOPPING.
if (reconf_queue_flag_) { if (reconf_queue_flag_) {
LOG_DEBUG(dctl_logger, DBGLVL_TRACE_BASIC, LOG_DEBUG(d2_logger, DBGLVL_TRACE_BASIC,
DHCP_DDNS_QUEUE_MGR_RECONFIGURING); DHCP_DDNS_QUEUE_MGR_RECONFIGURING);
reconfigureQueueMgr(); reconfigureQueueMgr();
} }
@@ -326,7 +326,7 @@ D2Process::reconfigureQueueMgr() {
/// @todo Remove this once we provide a secure mechanism. /// @todo Remove this once we provide a secure mechanism.
std::string ip_address = d2_params->getIpAddress().toText(); std::string ip_address = d2_params->getIpAddress().toText();
if (ip_address != "127.0.0.1" && ip_address != "::1") { 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. // Instantiate the listener.
@@ -350,7 +350,7 @@ D2Process::reconfigureQueueMgr() {
// Queue manager failed to initialize and therefore not listening. // Queue manager failed to initialize and therefore not listening.
// This is most likely due to an unavailable IP address or port, // This is most likely due to an unavailable IP address or port,
// which is a configuration issue. // 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 // @todo This is the initial implementation. If and when D2 is extended
// to support its own commands, this implementation must change. Otherwise // to support its own commands, this implementation must change. Otherwise
// it should reject all commands as it does now. // 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)"); .arg(command).arg(args ? args->str() : "(no args)");
return (isc::config::createAnswer(COMMAND_INVALID, "Unrecognized command: " return (isc::config::createAnswer(COMMAND_INVALID, "Unrecognized command: "

View File

@@ -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 // 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 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -137,7 +137,7 @@ D2QueueMgr::startListening() {
<< ex.what()); << 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 void
@@ -172,7 +172,7 @@ D2QueueMgr::stopListening(const State target_stop_state) {
void void
D2QueueMgr::updateStopState() { D2QueueMgr::updateStopState() {
mgr_state_ = target_stop_state_; 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);
} }

View File

@@ -36,9 +36,9 @@ EXTRA_DIST = process_messages.mes
CLEANFILES = *.gcno *.gcda spec_config.h process_messages.h process_messages.cc s-messages CLEANFILES = *.gcno *.gcda spec_config.h process_messages.h process_messages.cc s-messages
lib_LTLIBRARIES = libkea-process.la 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_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 += d_process.h
libkea_process_la_SOURCES += io_service_signal.cc io_service_signal.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. # Specify the headers for copying into the installation directory tree.
libkea_process_includedir = $(pkgincludedir)/process libkea_process_includedir = $(pkgincludedir)/process
libkea_process_include_HEADERS = \ libkea_process_include_HEADERS = \
d2_log.h \ d_log.h \
d_cfg_mgr.h \ d_cfg_mgr.h \
d_controller.h \ d_controller.h \
d_process.h \ d_process.h \

View File

@@ -9,7 +9,7 @@
#include <cc/command_interpreter.h> #include <cc/command_interpreter.h>
#include <dhcp/libdhcp++.h> #include <dhcp/libdhcp++.h>
#include <dhcpsrv/parsers/dhcp_parsers.h> #include <dhcpsrv/parsers/dhcp_parsers.h>
#include <process/d2_log.h> #include <process/d_log.h>
#include <process/d_cfg_mgr.h> #include <process/d_cfg_mgr.h>
#include <util/encode/hex.h> #include <util/encode/hex.h>
#include <util/strutil.h> #include <util/strutil.h>

View File

@@ -12,7 +12,7 @@
#include <exceptions/exceptions.h> #include <exceptions/exceptions.h>
#include <log/logger.h> #include <log/logger.h>
#include <log/logger_support.h> #include <log/logger_support.h>
#include <process/d2_log.h> #include <process/d_log.h>
#include <process/d_controller.h> #include <process/d_controller.h>
#ifdef HAVE_MYSQL #ifdef HAVE_MYSQL

View File

@@ -12,7 +12,7 @@
#include <dhcpsrv/daemon.h> #include <dhcpsrv/daemon.h>
#include <exceptions/exceptions.h> #include <exceptions/exceptions.h>
#include <log/logger_support.h> #include <log/logger_support.h>
#include <process/d2_log.h> #include <process/d_log.h>
#include <process/d_process.h> #include <process/d_process.h>
#include <process/io_service_signal.h> #include <process/io_service_signal.h>

View File

@@ -6,13 +6,13 @@
/// Defines the logger used by the top-level component of kea-dhcp-ddns. /// Defines the logger used by the top-level component of kea-dhcp-ddns.
#include <process/d2_log.h> #include <process/d_log.h>
namespace isc { namespace isc {
namespace d2 { namespace d2 {
/// @brief Defines the logger used within libkea-process library. /// @brief Defines the logger used within libkea-process library.
isc::log::Logger dctl_logger("dhcpddns"); isc::log::Logger dctl_logger("dctl");
} // namespace d2 } // namespace d2
} // namespace isc } // namespace isc

View File

@@ -5,7 +5,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <asiolink/interval_timer.h> #include <asiolink/interval_timer.h>
#include <process/d2_log.h> #include <process/d_log.h>
#include <process/io_service_signal.h> #include <process/io_service_signal.h>
namespace isc { namespace isc {

View File

@@ -5,7 +5,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <log/logger_support.h> #include <log/logger_support.h>
#include <process/d2_log.h> #include <process/d_log.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
int int

View File

@@ -6,7 +6,7 @@
#include <config.h> #include <config.h>
#include <asiolink/io_service.h> #include <asiolink/io_service.h>
#include <process/d2_log.h> #include <process/d_log.h>
#include <process/spec_config.h> #include <process/spec_config.h>
#include <process/testutils/d_test_stubs.h> #include <process/testutils/d_test_stubs.h>