summaryrefslogtreecommitdiffstats
path: root/src/bin/lfc/lfc_controller.cc
diff options
context:
space:
mode:
authorShawn Routhier <sar@isc.org>2015-02-11 06:16:57 +0100
committerShawn Routhier <sar@isc.org>2015-02-11 06:16:57 +0100
commit6c4cc8c9131cfe3a7689289539c44328a8dac78e (patch)
tree8859430e3c2baa9c562a18c99fd754495ef609b3 /src/bin/lfc/lfc_controller.cc
parent[trac3667] Use basic logging facility for output and error messages. (diff)
downloadkea-6c4cc8c9131cfe3a7689289539c44328a8dac78e.tar.xz
kea-6c4cc8c9131cfe3a7689289539c44328a8dac78e.zip
[trac3667] Complete logging work and add soem stats
Complete the current working on using the basic logging system for messages from LFC Add lease_stats to provide a class to gather statistics about reading and writing leases to files. Currently this is used by the CSV file code and output by LFC. The information counted is: number of attempts, number of leases and number of errors generated during reads and writes.
Diffstat (limited to 'src/bin/lfc/lfc_controller.cc')
-rw-r--r--src/bin/lfc/lfc_controller.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/bin/lfc/lfc_controller.cc b/src/bin/lfc/lfc_controller.cc
index df175c0adc..ae8cc226eb 100644
--- a/src/bin/lfc/lfc_controller.cc
+++ b/src/bin/lfc/lfc_controller.cc
@@ -64,7 +64,7 @@ LFCController::launch(int argc, char* argv[], const bool test_mode) {
// If we aren't running in test mode initialize the logging
// system with the defaults.
if (!test_mode)
- initLogger(lfc_app_name_, WARN, 0, NULL, false);
+ initLogger(lfc_app_name_, INFO, 0, NULL, false);
try {
parseArgs(argc, argv);
@@ -345,6 +345,17 @@ LFCController::processLeases() const {
LeaseFileType lf_output(getOutputFile());
LeaseFileLoader::write<LeaseObjectType>(lf_output, storage);
+ // If desired log the stats
+ LOG_INFO(lfc_logger, LFC_READ_MESSAGE)
+ .arg(lf_prev.getReadLeases() + lf_copy.getReadLeases())
+ .arg(lf_prev.getReads() + lf_copy.getReads())
+ .arg(lf_prev.getReadErrs() + lf_copy.getReadErrs());
+
+ LOG_INFO(lfc_logger, LFC_WRITE_MESSAGE)
+ .arg(lf_output.getWriteLeases())
+ .arg(lf_output.getWrites())
+ .arg(lf_output.getWriteErrs());
+
// Once we've finished the output file move it to the complete file
if (rename(getOutputFile().c_str(), getFinishFile().c_str()) != 0) {
isc_throw(RunTimeFail, "Unable to move output (" << output_file_