+XXX. [func] sar
+ A class, LeaseFileStats, has been added to provide simple
+ statistics for use with lease files. Also added logging
+ to the kea-lfc process per the design.
+ See http://kea.isc.org/wiki/LFCDesign for the design.
+ (Trac #3667, git )
+
887. [func] sar
A new process, kea-lfc, has been added. It is meant to
be periodically executed by the DHCPv4 and DHCPv6 servers
usage(ex.what());
throw; // rethrow it
}
- // If we are running in test mode use the environment variables
- // else use our defaults
- if (test_mode) {
- initLogger();
- }
- else {
- OutputOption option;
- LoggerManager manager;
-
- initLogger(lfc_app_name_, INFO, 0, NULL, false);
-
- // Prepare the objects to define the logging specification
- LoggerSpecification spec(getRootLoggerName(),
- keaLoggerSeverity(INFO),
- keaLoggerDbglevel(0));
-
- // If we are running in verbose (debugging) mode
- // we send the output to the console, otherwise
- // by default we send it to the SYSLOG
- if (verbose_) {
- option.destination = OutputOption::DEST_CONSOLE;
- } else {
- option.destination = OutputOption::DEST_SYSLOG;
-
- }
-
- // ... and set the destination
- spec.addOutputOption(option);
- manager.process(spec);
- }
+ // Start up the logging system.
+ startLogger(test_mode);
LOG_INFO(lfc_logger, LFC_START);
<< ") error: " << strerror(errno));
}
}
+
+void
+LFCController::startLogger(const bool test_mode) const {
+ // If we are running in test mode use the environment variables
+ // else use our defaults
+ if (test_mode) {
+ initLogger();
+ }
+ else {
+ OutputOption option;
+ LoggerManager manager;
+
+ initLogger(lfc_app_name_, INFO, 0, NULL, false);
+
+ // Prepare the objects to define the logging specification
+ LoggerSpecification spec(getRootLoggerName(),
+ keaLoggerSeverity(INFO),
+ keaLoggerDbglevel(0));
+
+ // If we are running in verbose (debugging) mode
+ // we send the output to the console, otherwise
+ // by default we send it to the SYSLOG
+ if (verbose_) {
+ option.destination = OutputOption::DEST_CONSOLE;
+ } else {
+ option.destination = OutputOption::DEST_SYSLOG;
+ }
+
+ // ... and set the destination
+ spec.addOutputOption(option);
+
+ manager.process(spec);
+ }
+}
+
}; // namespace isc::lfc
}; // namespace isc
/// @throw RunTimeFail if we can't move the file.
template<typename LeaseObjectType, typename LeaseFileType, typename StorageType>
void processLeases() const;
+
+ ///@brief Start up the logging system
+ ///
+ /// @param test_mode indicates if we have have been started from the test
+ /// system (true) or are running normally (false)
+ void startLogger(const bool test_mode) const;
};
}; // namespace isc::lfc
/// lfcController::launch for details. This is wrapped to provide
/// a single place to update the test_mode throughout the file.
void launch(LFCController lfc_controller, int argc, char* argv[]) {
- lfc_controller.launch(argc, argv, false);
+ lfc_controller.launch(argc, argv, true);
}
private:
libkea_dhcpsrv_la_SOURCES += key_from_key.h
libkea_dhcpsrv_la_SOURCES += lease.cc lease.h
libkea_dhcpsrv_la_SOURCES += lease_file_loader.h
+libkea_dhcpsrv_la_SOURCES += lease_file_stats.h
libkea_dhcpsrv_la_SOURCES += lease_mgr.cc lease_mgr.h
libkea_dhcpsrv_la_SOURCES += lease_mgr_factory.cc lease_mgr_factory.h
-libkea_dhcpsrv_la_SOURCES += lease_stats.h
libkea_dhcpsrv_la_SOURCES += logging.cc logging.h
libkea_dhcpsrv_la_SOURCES += logging_info.cc logging_info.h
libkea_dhcpsrv_la_SOURCES += memfile_lease_mgr.cc memfile_lease_mgr.h
#include <dhcp/duid.h>
#include <dhcpsrv/lease.h>
#include <dhcpsrv/subnet.h>
-#include <dhcpsrv/lease_stats.h>
+#include <dhcpsrv/lease_file_stats.h>
#include <util/csv_file.h>
#include <stdint.h>
#include <string>
#include <dhcp/duid.h>
#include <dhcpsrv/lease.h>
#include <dhcpsrv/subnet.h>
-#include <dhcpsrv/lease_stats.h>
+#include <dhcpsrv/lease_file_stats.h>
#include <util/csv_file.h>
#include <stdint.h>
#include <string>
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
-#ifndef LEASE_STATS_H
-#define LEASE_STATS_H
+#ifndef LEASE_FILE_STATS_H
+#define LEASE_FILE_STATS_H
namespace isc {
namespace dhcp {
} // namespace isc::dhcp
} // namesapce isc
-#endif // LEASE_STATS_H
+#endif // LEASE_FILE_STATS_H