Commit 64e589b7 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[3400] Minor clean up after recent changes.

 - loggerInit method moved to specific backends
 - --with-kea-config parameter renamed: BIND10 => Bundy
parent 6dd61059
......@@ -1287,19 +1287,19 @@ AC_SUBST(AWK)
# Kea configuration backend section
# Currently there are 2 backends available: BIND10 and JSON
# Currently there are 2 backends available: BUNDY and JSON
# It is possible that we may extend this to accept additional backends.
AC_ARG_WITH(kea-config,
AC_HELP_STRING([--with-kea-config],
[Selects configuration backend; currently available options are: BIND10 (default) or JSON]),
[Selects configuration backend; currently available options are: BUNDY (default) or JSON]),
[CONFIG_BACKEND="$withval"],
[CONFIG_BACKEND=BIND10])
[CONFIG_BACKEND=BUNDY])
AM_CONDITIONAL(CONFIG_BACKEND_BIND10, test "x$CONFIG_BACKEND" = "xBIND10")
AM_CONDITIONAL(CONFIG_BACKEND_BUNDY, test "x$CONFIG_BACKEND" = "xBUNDY")
AM_CONDITIONAL(CONFIG_BACKEND_JSON, test "x$CONFIG_BACKEND" = "xJSON")
if test "x$CONFIG_BACKEND" = "xBIND10"; then
AC_DEFINE(CONFIG_BACKEND_BIND10, 1, [Define to 1 if Kea config was set to BIND10])
if test "x$CONFIG_BACKEND" = "xBUNDY"; then
AC_DEFINE(CONFIG_BACKEND_BUNDY, 1, [Define to 1 if Kea config was set to BUNDY])
fi
if test "x$CONFIG_BACKEND" = "xJSON"; then
......@@ -1307,8 +1307,8 @@ if test "x$CONFIG_BACKEND" = "xJSON"; then
fi
# Let's sanity check if the specified backend value is allowed
if test "x$CONFIG_BACKEND" != "xBIND10" && test "x$CONFIG_BACKEND" != "xJSON"; then
AC_MSG_ERROR("Invalid configuration backend specified: $CONFIG_BACKEND. The only supported are: BIND10 JSON")
if test "x$CONFIG_BACKEND" != "xBUNDY" && test "x$CONFIG_BACKEND" != "xJSON"; then
AC_MSG_ERROR("Invalid configuration backend specified: $CONFIG_BACKEND. The only supported are: BUNDY JSON")
fi
AC_ARG_ENABLE(generate_docs, [AC_HELP_STRING([--enable-generate-docs],
......@@ -1651,7 +1651,6 @@ SQLite:
Kea config backend:
CONFIG_BACKEND: ${CONFIG_BACKEND}
END
# Avoid confusion on DNS/DHCP and only mention MySQL if it
......
......@@ -3,6 +3,7 @@ SUBDIRS = . tests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/cc -I$(top_builddir)/src/lib/cc
AM_CPPFLAGS += -DTOP_BUILDDIR="\"$(top_builddir)\""
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CXXFLAGS = $(B10_CXXFLAGS)
......@@ -57,7 +58,7 @@ b10_dhcp6_SOURCES += dhcp6_srv.cc dhcp6_srv.h
b10_dhcp6_SOURCES += ctrl_dhcp6_srv.cc ctrl_dhcp6_srv.h
b10_dhcp6_SOURCES += json_config_parser.cc json_config_parser.h
if CONFIG_BACKEND_BIND10
if CONFIG_BACKEND_BUNDY
b10_dhcp6_SOURCES += bundy_backend.cc
endif
......
......@@ -216,5 +216,12 @@ void ControlledDhcpv6Srv::cleanup() {
}
}
void
Daemon::loggerInit(const char* log_name, bool verbose, bool stand_alone) {
isc::log::initLogger(log_name,
(verbose ? isc::log::DEBUG : isc::log::INFO),
isc::log::MAX_DEBUG_LEVEL, NULL, !stand_alone);
}
}; // end of isc::dhcp namespace
}; // end of isc namespace
......@@ -22,6 +22,12 @@
#include <dhcp6/ctrl_dhcp6_srv.h>
#include <dhcp6/dhcp6_log.h>
#include <dhcp6/spec_config.h>
#include <log/logger_level.h>
#include <log/logger_name.h>
#include <log/logger_manager.h>
#include <log/logger_specification.h>
#include <log/logger_support.h>
#include <log/output_option.h>
#include <exceptions/exceptions.h>
#include <util/buffer.h>
......@@ -120,5 +126,38 @@ 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* log_name, bool verbose, bool ) {
// This method configures logger. For now it is very simple.
// We'll make it more robust once we add support for JSON-based logging
// configuration.
using namespace isc::log;
Severity severity = b10LoggerSeverity(verbose ? isc::log::DEBUG : isc::log::INFO);
// Set a directory for creating lockfiles when running tests
// @todo: Find out why this is needed. Without this, the logger doesn't
// work.
setenv("B10_LOCKFILE_DIR_FROM_BUILD", TOP_BUILDDIR, 1);
// Initialize logging
initLogger(log_name, severity, isc::log::MAX_DEBUG_LEVEL, NULL);
// Now configure logger output to stdout.
/// @todo: Make this configurable as part of #3427.
LoggerSpecification spec(log_name, severity,
b10LoggerDbglevel(isc::log::MAX_DEBUG_LEVEL));
OutputOption option;
option.destination = OutputOption::DEST_CONSOLE;
option.stream = OutputOption::STR_STDOUT;
spec.addOutputOption(option);
LoggerManager manager;
manager.process(spec);
}
};
};
......@@ -24,6 +24,7 @@ check-local:
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_builddir)/src/bin # for generated spec_config.h header
AM_CPPFLAGS += -I$(top_srcdir)/src/bin
AM_CPPFLAGS += -DTOP_BUILDDIR="\"$(top_builddir)\""
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
......@@ -87,9 +88,9 @@ dhcp6_unittests_SOURCES += rebind_unittest.cc
dhcp6_unittests_SOURCES += ../json_config_parser.cc ../json_config_parser.h
dhcp6_unittests_SOURCES += config_parser_unittest.cc
if CONFIG_BACKEND_BIND10
if CONFIG_BACKEND_BUNDY
# For Bundy backend, we only need to run the usual tests. There are no
# Bundy-specific tests.
# Bundy-specific tests yet.
dhcp6_unittests_SOURCES += ../bundy_backend.cc
dhcp6_unittests_SOURCES += bundy_backend_unittest.cc
endif
......
......@@ -13,12 +13,6 @@
// PERFORMANCE OF THIS SOFTWARE.
#include <config.h>
#include <log/logger_level.h>
#include <log/logger_name.h>
#include <log/logger_manager.h>
#include <log/logger_specification.h>
#include <log/logger_support.h>
#include <log/output_option.h>
#include <dhcpsrv/daemon.h>
#include <exceptions/exceptions.h>
#include <errno.h>
......@@ -48,35 +42,5 @@ void Daemon::shutdown() {
Daemon::~Daemon() {
}
void Daemon::loggerInit(const char* log_name, bool verbose, bool ) {
// This method configures logger. For now it is very simple.
// We'll make it more robust once we add support for JSON-based logging
// configuration.
using namespace isc::log;
Severity severity = b10LoggerSeverity(verbose ? isc::log::DEBUG : isc::log::INFO);
// Set a directory for creating lockfiles when running tests
// @todo: Find out why this is needed. Without this, the logger doesn't
// work.
setenv("B10_LOCKFILE_DIR_FROM_BUILD", TOP_BUILDDIR, 1);
// Initialize logging
initLogger(log_name, severity, isc::log::MAX_DEBUG_LEVEL, NULL);
// Now configure logger output to stdout.
/// @todo: Make this configurable as part of #3427.
LoggerSpecification spec(log_name, severity,
b10LoggerDbglevel(isc::log::MAX_DEBUG_LEVEL));
OutputOption option;
option.destination = OutputOption::DEST_CONSOLE;
option.stream = OutputOption::STR_STDOUT;
spec.addOutputOption(option);
LoggerManager manager;
manager.process(spec);
}
};
};
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