From 5b3f3f548d9c1f3068bcb9639ca54441fecc9b0c Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Wed, 6 Oct 2010 15:39:41 +0200 Subject: [PATCH] Log before exiting the application on config reload error --- src/logger.cpp | 11 +++++++++++ src/logger.hpp | 2 ++ src/main.cpp | 3 +++ 3 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/logger.cpp b/src/logger.cpp index e94822a..fda6f85 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -301,6 +301,17 @@ void Logger::print_conf_not_loaded(const string& config_path) const /** + * Prints out the unsuccessful parsing of the config files. + */ +void Logger::print_conf_reload_failed_exit() const +{ + int level = 0; + if ( level <= Loglevel ) + log_error("Config files couldn't be reloaded. Exiting."); +} + + +/** * A file could not be opened for reading. * @param filename The filename. */ diff --git a/src/logger.hpp b/src/logger.hpp index 9c95b8e..93be3e2 100644 --- a/src/logger.hpp +++ b/src/logger.hpp @@ -100,6 +100,8 @@ public: void print_conf_not_loaded(const std::string& config_path) const; + void print_conf_reload_failed_exit() const; + void print_missing_cmd_service_option() const; void print_missing_service_conf_option(const std::string& service_conf_file) const; diff --git a/src/main.cpp b/src/main.cpp index 94bc813..54022da 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -335,7 +335,10 @@ int main(int argc, char *argv[]) need_config_reload = false; if ( updater->reload_config() != 0 ) + { + updater->get_logger()->print_conf_reload_failed_exit(); exit(-1); + } } // Snore, snore... don't hog the cpu if we are in daemon_mode. -- 1.7.1