--template '{file}:{line}: check_fail: {message} ({severity},{id})' \
src
+# These steps are necessary during installation
+install-exec-hook:
+ mkdir -p ${localstatedir}/run/${PACKAGE_NAME}
+
### include tool to generate documentation from log message specifications
### in the distributed tarball:
EXTRA_DIST = tools/system_messages.py
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
- export B10_LOCKFILE_DIR_FROM_BUILD=$(abs_top_builddir); \
+ export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
- export B10_LOCKFILE_DIR_FROM_BUILD=$(abs_top_builddir); \
+ export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
check-local:
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
- export B10_LOCKFILE_DIR_FROM_BUILD=$(abs_top_builddir); \
+ export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
done
for shtest in $(SHTESTS) ; do \
echo Running test: $$shtest ; \
chmod +x $(abs_builddir)/$$shtest ; \
+ export KEA_LOCKFILE_DIR=$(abs_top_builddir); \
export KEACTRL_BUILD_DIR=$(abs_top_builddir); \
export KEACTRL_CONF=$(abs_top_builddir)/src/bin/keactrl/tests/keactrl_test.conf; \
${SHELL} $(abs_builddir)/$$shtest || exit ; \
parser.applyConfiguration();
}
-void Daemon::loggerInit(const char*, bool verbose) {
-
- setenv("KEA_LOCKFILE_DIR", "/tmp", 0);
+void Daemon::loggerInit(const char* name, bool verbose) {
// Initialize logger system
- isc::log::initLogger(isc::log::getDefaultRootLoggerName().c_str(),
- isc::log::DEBUG, isc::log::MAX_DEBUG_LEVEL,
+ isc::log::initLogger(name, isc::log::DEBUG, isc::log::MAX_DEBUG_LEVEL,
NULL);
// Apply default configuration (log INFO or DEBUG to stdout)
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <log/logger_specification.h>
+#include <log/logger_support.h>
#include <log/logger_manager.h>
#include <log/logger_name.h>
}
void LogConfigParser::applyDefaultConfiguration(bool verbose) {
- LoggerSpecification spec("kea", (verbose?isc::log::DEBUG : isc::log::INFO),
+ LoggerSpecification spec(isc::log::getRootLoggerName(),
+ (verbose?isc::log::DEBUG : isc::log::INFO),
(verbose?99:0));
- OutputOption option;
- option.destination = OutputOption::DEST_CONSOLE;
- option.stream = OutputOption::STR_STDOUT;
-
- spec.addOutputOption(option);
-
- LoggerManager manager;
- manager.process(spec);
+ setDefaultLoggingOutput(verbose);
}
} // namespace isc::dhcp
SUBDIRS = . tests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
-AM_CPPFLAGS += -DLOCKFILE_DIR=\"${localstatedir}/${PACKAGE_NAME}\"
+AM_CPPFLAGS += -DLOCKFILE_DIR=\"${localstatedir}/run/${PACKAGE_NAME}\"
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CXXFLAGS = $(KEA_CXXFLAGS)
int dbglevel = 0, const char* file = NULL,
bool buffer = false);
+/// \brief Reset root logger characteristics
+///
+/// This is a simplified interface into the resetting of the characteristics
+/// of the root logger. It is aimed for use in unit tests and initial
+/// phase of bring up before logging configuration is parsed and applied.
+/// It uses KEA_LOGGER_DESTINATION environment variable to specify
+/// logging destination.
+/// @param verbose defines whether logging should be verbose or not
+void setDefaultLoggingOutput(bool verbose = true);
+
+
} // namespace log
} // namespace isc
// variables KEA_LOGGER_SEVERITY, KEA_LOGGER_DBGLEVEL and KEA_LOGGER_DESTINATION.
void
-resetUnitTestRootLogger() {
+setDefaultLoggingOutput(bool verbose) {
using namespace isc::log;
// Prepare the objects to define the logging specification
LoggerSpecification spec(getRootLoggerName(),
- keaLoggerSeverity(isc::log::DEBUG),
+ keaLoggerSeverity(verbose ? isc::log::DEBUG :
+ isc::log::INFO),
keaLoggerDbglevel(isc::log::MAX_DEBUG_LEVEL));
OutputOption option;
manager.process(spec);
}
-
// Logger Run-Time Initialization via Environment Variables
void initLogger(isc::log::Severity severity, int dbglevel) {
// in the environment variables. (The two-step approach is used as the
// setUnitTestRootLoggerCharacteristics() function is used in several
// places in the Kea tests, and it avoid duplicating code.)
- resetUnitTestRootLogger();
+ isc::log::setDefaultLoggingOutput();
}
} // namespace log
/// be overridden by the tester. It is not intended for use in production
/// code.
///
+/// @note: Do NOT use this function in production code as it creates
+/// lockfile in the build dir. That's ok for tests, but not
+/// ok for production code.
+///
/// @todo: Rename. This function overloads the initLogger() function that can
/// be used to initialize production programs. This may lead to confusion.
void initLogger(isc::log::Severity severity = isc::log::DEBUG,
/// \return Debug level to use.
int keaLoggerDbglevel(int defdbglevel);
-
-/// \brief Reset root logger characteristics
-///
-/// This is a simplified interface into the resetting of the characteristics
-/// of the root logger. It is aimed for use in unit tests and resets the
-/// characteristics of the root logger to use a severity, debug level and
-/// destination set by the environment variables KEA_LOGGER_SEVERITY,
-/// KEA_LOGGER_DBGLEVEL and KEA_LOGGER_DESTINATION.
-void
-resetUnitTestRootLogger();
-
} // namespace log
} // namespace isc
protected:
LoggerLevelImplTest() {
// Ensure logging set to default for unit tests
- resetUnitTestRootLogger();
+ setDefaultLoggingOutput();
}
~LoggerLevelImplTest()
LoggerLevelTest() {
// Logger initialization is done in main(). As logging tests may
// alter the default logging output, it is reset here.
- resetUnitTestRootLogger();
+ setDefaultLoggingOutput();
}
~LoggerLevelTest() {
LoggerManager::reset();
LoggerSupportTest() {
// Logger initialization is done in main(). As logging tests may
// alter the default logging output, it is reset here.
- resetUnitTestRootLogger();
+ setDefaultLoggingOutput();
}
~LoggerSupportTest() {
}