From: Tomek Mrugalski Date: Thu, 25 Sep 2014 10:41:51 +0000 (+0200) Subject: [master] Merge branch 'trac3591' (logging lockfile fix) X-Git-Tag: rt3470_base~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5e103c0b047ebd1bb1c9feca003e297c13bee6b;p=thirdparty%2Fkea.git [master] Merge branch 'trac3591' (logging lockfile fix) Conflicts: ChangeLog Makefile.am src/lib/dhcpsrv/daemon.cc --- a5e103c0b047ebd1bb1c9feca003e297c13bee6b diff --cc ChangeLog index 58cd280bd1,d7d3a3d7f5..36aca789d9 --- a/ChangeLog +++ b/ChangeLog @@@ -1,31 -1,8 +1,37 @@@ -8xx. [bug] tomek ++838. [bug] tomek + Kea components now use the KEA_LOCKFILE_DIR environment variable + to specify the directory of the logging lockfile. Locking can be + disabled completely by setting the variable to 'none'. - (Trac #3591, git tbd) ++ (Trac #3591, git d4556e1d21766b94f2f0cda59df15e47e6f2676e) ++ +837. [bug,doc] tomek + Logging configuration examples in kea.conf fixed. Also updated + Kea documentation for logging. + (Trac #3536, git 2cf3f6b9cb3d2ae6fc7b0940b55490f109ddd2f9) + +836. [bug] fdupont + Moved duplicated getXXXHashAlgorithm() function to new + xxx_common.h include files in the cryptolink library. + (Trac #3471, git 8cf2ee46b3d7398f4f716435be3d9b19bf3599f5) + +835. [build] fdupont + The configure script checks if OpenSSL supports SHA-2, in order + to avoid very old (and likely subject to unfixed security bugs) + OpenSSL versions. + (Trac #3482, git c779a0ef23d2092cf896276dab1fbcb190380374) + +834. [bug] marcin + Corrected the definition of the example DHCPv4 and DHCPv6 address + pools in the default kea.conf file. + (Trac #3538, git 8712cc0df77368940d8d3d11811a9ac9504bce12) + +833. [func] marcin + Configuration Manager supports two stage configuration. In the + first stage a temporary configuration is created and in the + second stage this configuration is committed. If configuration + fails at the first stage, the temporary configuration is rolled + back and the server continues to use the old configuration. + (Trac #3534, git 4ecee3c0c97fe417b050317356f9093ba3771a15) Kea 0.9 released on August 29, 2014 diff --cc Makefile.am index ea0d5786bd,b943445b98..69f7958723 --- a/Makefile.am +++ b/Makefile.am @@@ -121,7 -121,7 +121,8 @@@ cppcheck # These steps are necessary during installation install-exec-hook: + mkdir -p $(DESTDIR)${localstatedir}/log/ + mkdir -p $(DESTDIR)${localstatedir}/run/${PACKAGE_NAME} ### include tool to generate documentation from log message specifications ### in the distributed tarball: diff --cc doc/guide/logging.xml index cfa2f8b862,7e54f1e7c3..60a2846a35 --- a/doc/guide/logging.xml +++ b/doc/guide/logging.xml @@@ -20,25 -8,17 +20,25 @@@ Logging
- Logging configuration + Logging Configuration + During its operation Kea may produce many messages. They differ in + severity (some are more important than others) and source (some are + produced by specific components, e.g. hooks). It is useful to understand + which log messages are needed and which are not and configure your + logging appropriately. For example, debug level messages can be safely + ignored in a typical deployment. They are, however, very useful when + debugging a problem. + + The logging system in Kea is configured through the - Logging module. All modules will look at the - configuration in Logging to see what should be logged and - to where. - - - + Logging structure in your configuration + file. All daemons (e.g. DHCPv4 and DHCPv6 servers) will use the + configuration in the Logging structure to see + what should be logged and to where. This allows for sharing identical + logging configuration between daemons.
diff --cc src/lib/dhcpsrv/daemon.cc index bacd79947b,147b2f7674..ffe3ad0c94 --- a/src/lib/dhcpsrv/daemon.cc +++ b/src/lib/dhcpsrv/daemon.cc @@@ -57,26 -58,50 +59,36 @@@ void Daemon::handleSignal() } void Daemon::configureLogger(const isc::data::ConstElementPtr& log_config, - const ConfigurationPtr& storage, - bool verbose) { - - if (!log_config) { - // There was no logger configuration. Let's clear any config - // and revert to the default. - - isc::log::setDefaultLoggingOutput(verbose); // Set up default logging - return; - } - - isc::data::ConstElementPtr loggers = log_config->get("loggers"); - if (!loggers) { - // There is Logging structure, but it doesn't have loggers - // array in it. Let's clear any old logging configuration - // we may have and revert to the default. - - isc::log::setDefaultLoggingOutput(verbose); // Set up default logging - return; + const SrvConfigPtr& storage) { + + if (log_config) { + isc::data::ConstElementPtr loggers = log_config->get("loggers"); + if (loggers) { + LogConfigParser parser(storage); + parser.parseConfiguration(loggers, CfgMgr::instance().isVerbose()); + } } +} - // This is utility class that translates JSON structures into formats - // understandable by log4cplus. - LogConfigParser parser(storage); - - // Translate JSON structures into log4cplus formats - parser.parseConfiguration(loggers, verbose); - - // Apply the configuration +void +Daemon::setVerbose(bool verbose) { + CfgMgr::instance().setVerbose(verbose); +} - /// @todo: Once configuration unrolling is implemented, - /// this call will be moved to a separate method. - parser.applyConfiguration(); +bool +Daemon::getVerbose() const { + return (CfgMgr::instance().isVerbose()); } + void Daemon::loggerInit(const char* name, bool verbose) { + + // Initialize logger system + isc::log::initLogger(name, isc::log::DEBUG, isc::log::MAX_DEBUG_LEVEL, + NULL); + + // Apply default configuration (log INFO or DEBUG to stdout) + isc::log::setDefaultLoggingOutput(verbose); + } + }; };