Log before exiting the application on config reload error
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 6 Oct 2010 13:39:41 +0000 (15:39 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 6 Oct 2010 13:39:41 +0000 (15:39 +0200)
src/logger.cpp
src/logger.hpp
src/main.cpp

index e94822a..fda6f85 100644 (file)
@@ -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.
  */
index 9c95b8e..93be3e2 100644 (file)
@@ -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;
index 94bc813..54022da 100644 (file)
@@ -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.