Commit c24182c2 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[3591] Logging initialization cleaned up

parent d2246b8a
......@@ -424,17 +424,6 @@ DControllerBase::~DControllerBase() {
}; // namespace isc::d2
// Provide an implementation until we figure out a better way to do this.
void
dhcp::Daemon::loggerInit(const char* log_name, bool verbose) {
setenv("KEA_LOCKFILE_DIR_FROM_BUILD", "/tmp", 1);
setenv("KEA_LOGGER_ROOT", log_name, 0);
setenv("KEA_LOGGER_SEVERITY", (verbose ? "DEBUG":"INFO"), 0);
setenv("KEA_LOGGER_DBGLEVEL", "99", 0);
setenv("KEA_LOGGER_DESTINATION", "stdout", 0);
isc::log::initLogger();
}
}; // namespace isc
std::string
......
......@@ -211,12 +211,5 @@ void ControlledDhcpv4Srv::cleanup() {
}
}
void
Daemon::loggerInit(const char* log_name, bool verbose) {
isc::log::initLogger(log_name,
(verbose ? isc::log::DEBUG : isc::log::INFO),
isc::log::MAX_DEBUG_LEVEL, NULL, true);
}
};
};
......@@ -165,18 +165,5 @@ void ControlledDhcpv4Srv::cleanup() {
// Nothing to do here. No need to disconnect from anything.
}
/// This is a logger initialization for JSON file backend.
/// For now, it's just setting log messages to be printed on stdout.
/// @todo: Implement this properly (see #3427)
void Daemon::loggerInit(const char* logger_name, bool verbose) {
setenv("KEA_LOCKFILE_DIR_FROM_BUILD", "/tmp", 1);
setenv("KEA_LOGGER_ROOT", logger_name, 0);
setenv("KEA_LOGGER_SEVERITY", (verbose ? "DEBUG":"INFO"), 0);
setenv("KEA_LOGGER_DBGLEVEL", "99", 0);
setenv("KEA_LOGGER_DESTINATION", "stdout", 0);
isc::log::initLogger();
}
};
};
......@@ -222,12 +222,5 @@ void ControlledDhcpv6Srv::cleanup() {
}
}
void
Daemon::loggerInit(const char* log_name, bool verbose) {
isc::log::initLogger(log_name,
(verbose ? isc::log::DEBUG : isc::log::INFO),
isc::log::MAX_DEBUG_LEVEL, NULL, true);
}
}; // end of isc::dhcp namespace
}; // end of isc namespace
......@@ -169,18 +169,5 @@ void ControlledDhcpv6Srv::cleanup() {
// Nothing to do here. No need to disconnect from anything.
}
/// This is a logger initialization for JSON file backend.
/// For now, it's just setting log messages to be printed on stdout.
/// @todo: Implement this properly (see #3427)
void Daemon::loggerInit(const char* logger_name, bool verbose) {
setenv("KEA_LOCKFILE_DIR_FROM_BUILD", "/tmp", 1);
setenv("KEA_LOGGER_ROOT", logger_name, 0);
setenv("KEA_LOGGER_SEVERITY", (verbose ? "DEBUG":"INFO"), 0);
setenv("KEA_LOGGER_DBGLEVEL", "99", 0);
setenv("KEA_LOGGER_DESTINATION", "stdout", 0);
isc::log::initLogger();
}
};
};
......@@ -18,6 +18,8 @@
#include <cc/data.h>
#include <boost/bind.hpp>
#include <logging.h>
#include <log/logger_name.h>
#include <log/logger_support.h>
#include <errno.h>
/// @brief provides default implementation for basic daemon operations
......@@ -92,5 +94,18 @@ void Daemon::configureLogger(const isc::data::ConstElementPtr& log_config,
parser.applyConfiguration();
}
void Daemon::loggerInit(const char*, bool verbose) {
setenv("KEA_LOCKFILE_DIR_FROM_BUILD", "/tmp", 0);
// Initialize logger system
isc::log::initLogger(isc::log::getDefaultRootLoggerName().c_str(),
isc::log::DEBUG, isc::log::MAX_DEBUG_LEVEL,
NULL);
// Apply default configuration (log INFO or DEBUG to stdout)
LogConfigParser::applyDefaultConfiguration(verbose);
}
};
};
......@@ -111,8 +111,10 @@ public:
/// @brief Initializes logger
///
/// This method initializes logger. Currently its implementation is specific
/// to each configuration backend.
/// This method initializes logging system. It also sets the default
/// output to stdout. This is used in early stages of the startup
/// phase before config file and parsed and proper logging details
/// are known.
///
/// @param log_name name used in logger initialization
/// @param verbose verbose mode (true usually enables DEBUG messages)
......
......@@ -69,10 +69,11 @@ public:
/// @brief Configures default logging
///
/// This method is static,
/// This method is static, so it can be called in the initial phases of
/// the process start-up.
///
/// @param verbose specifies verbose mode (true forces DEBUG, debuglevel = 99)
void applyDefaultConfiguration(bool verbose = false);
static void applyDefaultConfiguration(bool verbose = false);
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment