Changes in Logger: Added member ExternalLogOnlyOnce. Changed some classifications...
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Fri, 21 May 2010 14:23:52 +0000 (16:23 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Fri, 21 May 2010 14:23:52 +0000 (16:23 +0200)
14 files changed:
src/config.cpp
src/config.h
src/httphelper.cpp
src/ip_addr_helper.cpp
src/logger.cpp
src/logger.h
src/service_dhs.cpp
src/service_dyndns.cpp
src/service_dyns.cpp
src/service_easydns.cpp
src/service_gnudip.cpp
src/service_tzo.cpp
src/service_zoneedit.cpp
src/updater.cpp

index e409103..e0de096 100644 (file)
@@ -91,6 +91,7 @@ Config::Config()
         ("http_proxy_port",po::value<int>(),"Port of the proxy.")
         ("external_warning_log",po::value<string>()->default_value(""),"External programm to pass warning log messages to.")
         ("external_warning_level",po::value<int>()->default_value(0),"Warning messages of which loglevel should be passed to external programm.")
+        ("external_log_only_once",po::value<bool>()->default_value(false),"Log the same external message only once until next reload or restart.")
         ("start_offline",po::value<bool>()->default_value(false),"Start in offline mode.")
     ;
 
@@ -164,6 +165,7 @@ Config::Config(Logger::Ptr _log, Serviceholder::Ptr _serviceholder)
         ("http_proxy_port",po::value<int>(),"Port of the proxy.")
         ("external_warning_log",po::value<string>()->default_value(""),"External programm to pass warning log messages to.")
         ("external_warning_level",po::value<int>()->default_value(0),"Warning messages of which loglevel should be passed to external programm.")
+        ("external_log_only_once",po::value<bool>()->default_value(false),"Log the same external message only once until next reload or restart.")
         ("start_offline",po::value<bool>()->default_value(false),"Start in offline mode.")
     ;
 
@@ -314,6 +316,9 @@ int Config::parse_cmd_line(int argc, char *argv[])
         if ( VariablesMap.count("external_warning_level") )
             ExternalWarningLevel = VariablesMap["external_warning_level"].as<int>();
 
+        if ( VariablesMap.count("external_log_only_once") )
+            StartOffline = VariablesMap["external_log_only_once"].as<bool>();
+
         if ( VariablesMap.count("start_offline") )
             StartOffline = VariablesMap["start_offline"].as<bool>();
 
@@ -397,7 +402,6 @@ Service::Ptr Config::create_service(const string &protocol, const string& server
     }
     else if(protocol == "gnudip")
     {
-        cout << "Server: " << server << endl; 
         if ( !server.empty() )
         {
             Service::Ptr service_gnudip(new ServiceGnudip(protocol,server,hostname,login,password,Log,update_interval,max_updates_within_interval,dns_cache_ttl,Proxy,ProxyPort));
@@ -573,6 +577,9 @@ int Config::load_main_config_file(const string& full_filename)
             if ( VariablesMap.count("external_warning_level") )
                 ExternalWarningLevel = VariablesMap["external_warning_level"].as<int>();
 
+            if ( VariablesMap.count("external_log_only_once") )
+                StartOffline = VariablesMap["external_log_only_once"].as<bool>();
+
             if ( VariablesMap.count("start_offline") )
                 StartOffline = VariablesMap["start_offline"].as<bool>();
 
@@ -822,3 +829,13 @@ bool Config::get_start_offline() const
 {
     return StartOffline;
 }
+
+
+/**
+ * Get member ExternalLogOnlyOnce
+ * @return StartOffline
+ */
+bool Config::get_external_log_only_once() const
+{
+    return ExternalLogOnlyOnce;
+}
index b282c6e..3b90b84 100644 (file)
@@ -48,6 +48,7 @@ private:
     int ExternalWarningLevel;
     bool StartOffline;
     bool WebcheckEnabled;
+    bool ExternalLogOnlyOnce;
 
     Service::Ptr create_service(const std::string& protocol, const std::string& server, const std::string& hostname, const std::string& login, const std::string& password, const int update_interval, const int max_updates_within_interval, const int dns_cache_ttl);
     int load_main_config_file(const std::string& full_filename);
@@ -103,6 +104,8 @@ public:
 
     bool get_start_offline() const;
 
+    bool get_external_log_only_once() const;
+
 };
 
 #endif
index 428286a..5e0c998 100644 (file)
@@ -141,7 +141,7 @@ string HTTPHelper::get_curl_data() const
  */
 CURL* HTTPHelper::init_curl(string& curl_writedata_buff,char* curl_err_buff)
 {
-    string user_agent = "Bullet Proof DYNDNS Daemon 0.1.1 - Intra2net AG 2009";
+    string user_agent = "Bullet Proof DYNDNS Daemon 0.1.1 - Intra2net AG 2010";
 
     CURL *curl_easy_handle = curl_easy_init();
     if ( curl_easy_handle == NULL )
index 280257c..cdfc164 100644 (file)
@@ -549,7 +549,7 @@ CURLcode IPAddrHelper::set_curl_url(CURL * curl_easy_handle, const string& url)
  */
 CURL * IPAddrHelper::init_curl(string& curl_writedata_buff,char* curl_err_buff) const
 {
-    string user_agent = "Bullet Proof DYNDNS Daemon 0.1.1 - Intra2net AG 2009";
+    string user_agent = "Bullet Proof DYNDNS Daemon 0.1.1 - Intra2net AG 2010";
 
     CURL *curl_easy_handle = curl_easy_init();
     if ( curl_easy_handle == NULL )
index 68d4cad..7c05478 100644 (file)
@@ -33,8 +33,9 @@ Logger::Logger()
     : Loglevel(0)
     , Syslog(false)
     , ExternalWarningLevel(0)
+    , ExternalLogOnlyOnce(false)
 {
-    set_log_facility(Loglevel,Syslog,ExternalWarningLog,ExternalWarningLevel);
+    set_log_facility(Loglevel,Syslog,ExternalWarningLog,ExternalWarningLevel,ExternalLogOnlyOnce);
 }
 
 
@@ -47,6 +48,27 @@ Logger::~Logger()
 
 
 /**
+ * Decides if a external log message can be send.
+ * @param msg The message to log.
+ */
+bool Logger::is_allowed_to_send( const string& msg ) const
+{
+    if ( (ExternalLogOnlyOnce) && (ExternalSendMessages.find(msg) != ExternalSendMessages.end()) )
+        return false;
+    return true;
+}
+
+
+/**
+ * Clears the external send messages set.
+ */
+void Logger::clear_external_send_messages()
+{
+    ExternalSendMessages.clear();
+}
+
+
+/**
  * Decides if Logging through syslog if enabled or through std.
  * @param msg The message to log.
  */
@@ -63,22 +85,29 @@ void Logger::log_notice(const string& msg) const
  * Decides if Logging through syslog if enabled or through std.
  * @param msg The message to log.
  */
-void Logger::log_warning(const string& msg, int level) const
+void Logger::log_warning(const string& msg, int level)
 {
     if ( Syslog )
         syslog(LOG_WARNING,msg.c_str());
     else
         cout << msg << endl;
 
-    if ( (level <= ExternalWarningLevel) && (!ExternalWarningLog.empty()) )
+    if ( (level <= ExternalWarningLevel) && (!ExternalWarningLog.empty()) && (is_allowed_to_send(msg)) )
     {
+        string message = msg;
+        // Remove endline from msg.
+        if (!message.empty() && message[message.length()-1] == '\n')
+            message.erase(message.length()-1);
+
         string external = ExternalWarningLog;
         external.append(" ");
         external.append("\"");
-        external.append(msg);
+        external.append(message);
         external.append("\"");
         if ( system(external.c_str()) != 0 )
             print_error_external_logging(external);
+        else
+            ExternalSendMessages.insert(msg);
     }
 }
 
@@ -100,10 +129,19 @@ void Logger::log_error(const string& msg) const
  * Setter for member Loglevel.
  * @param _loglevel Value to set Loglevel to.
  */
+void Logger::set_external_log_only_once( const bool _external_log_only_once )
+{
+    ExternalLogOnlyOnce = _external_log_only_once;
+}
+
+
+/**
+ * Setter for member Loglevel.
+ * @param _loglevel Value to set Loglevel to.
+ */
 void Logger::set_loglevel(const int _loglevel)
 {
     Loglevel = _loglevel;
-    cout << "Loglevel set" << endl;
 }
 
 
@@ -140,13 +178,13 @@ bool Logger::get_syslog() const
 /**
  * Initialize the logging facility.
  */
-void Logger::set_log_facility(const int _loglevel, const bool _syslog, const string& _external_error_log, const int _external_error_level)
+void Logger::set_log_facility(const int _loglevel, const bool _syslog, const string& _external_error_log, const int _external_error_level, const bool _external_log_only_once )
 {
     Loglevel = _loglevel;
     Syslog = _syslog;
     ExternalWarningLog = _external_error_log;
     ExternalWarningLevel = _external_error_level;
-
+    ExternalLogOnlyOnce = _external_log_only_once;
 
     if ( Syslog )
         openlog("bpdyndnsd",LOG_PID,LOG_DAEMON);
@@ -777,7 +815,7 @@ void Logger::print_child_killed(const int pid) const
  * There is no object file.
  * @param object_file The object file.
  */
-void Logger::print_no_object_file(const string& object_file) const
+void Logger::print_no_object_file(const string& object_file)
 {
     int level = 1;
     if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
@@ -849,7 +887,7 @@ void Logger::print_error_hostname_to_ip(const string& errMsg, const string& host
     {
         ostringstream msg;
         msg << "Could not resolve the hostname: " << hostname << " to an IP-Address: " << errMsg << endl;
-        log_warning(msg.str(),level);
+        log_error(msg.str());
     }
 }
 
@@ -873,7 +911,7 @@ void Logger::print_update_service_successful(const string& service) const
 /**
  * No ip could be determined through webcheck
  */
-void Logger::print_webcheck_no_ip() const
+void Logger::print_webcheck_no_ip()
 {
     int level = 0;
     if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
@@ -888,7 +926,7 @@ void Logger::print_webcheck_no_ip() const
  * @param curl_err_buff Curl error message
  * @param url the url
  */
-void Logger::print_webcheck_url_connection_problem(const char * curl_err_buff, const string& url) const
+void Logger::print_webcheck_url_connection_problem(const char * curl_err_buff, const string& url)
 {
     int level = 1;
     if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
@@ -953,7 +991,7 @@ void Logger::print_regex_found_ip(const string& ip) const
  * No IP was found through regex.
  * @param data The data string which should contain a valid IP.s
  */
-void Logger::print_regex_ip_not_found(const string& data) const
+void Logger::print_regex_ip_not_found(const string& data)
 {
     int level = 1;
     if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
@@ -988,7 +1026,7 @@ void Logger::print_multiple_cmd_option(const string& message) const
  * @param MaxUpdatesWithinInterval Number of allowed updates in one update interval.
  * @param service The service which exceeds update interval.
  */
-void Logger::print_update_not_allowed(const time_t current_time, const time_t old_time, const int MaxUpdatesWithinInterval, const string& service) const
+void Logger::print_update_not_allowed(const time_t current_time, const time_t old_time, const int MaxUpdatesWithinInterval, const string& service)
 {
     int level = 1;
     if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
@@ -1004,7 +1042,7 @@ void Logger::print_update_not_allowed(const time_t current_time, const time_t ol
  * Failure while running update for service.
  * @param service Services' name.
  */
-void Logger::print_update_service_failure(const string& service) const
+void Logger::print_update_service_failure(const string& service)
 {
     int level = 0;
     if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
@@ -1170,14 +1208,12 @@ void Logger::print_no_domain_part(const string& hostname) const
  * Service is not initialized properly.
  * @param service The service.
  */
-void Logger::print_service_not_initialized(const std::string& service) const
+void Logger::print_httphelper_not_initialized() const
 {
     int level = 0;
     if ( level <= Loglevel )
     {
-        ostringstream msg;
-        msg << "Service: " << service << " is not initialized properly." << endl;
-        log_warning(msg.str(),level);
+        log_error("HTTP-Helper is not initialized properly.");
     }
 }
 
@@ -1197,7 +1233,7 @@ void Logger::print_curl_error_init(const std::string& err_msg, const CURLcode cu
         curl_err = "UNKNOWN";
 
     int level = 0;
-    if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
+    if ( (level <= Loglevel) )
     {
         ostringstream msg;
         msg << "Curl error: " << err_msg << " Curl error code: " << curl_err_code << " " << curl_err << endl; /*lint !e641 */
@@ -1225,11 +1261,11 @@ void Logger::print_curl_error(const string& url, const CURLcode curl_err_code) c
         curl_err = "UNKNOWN";
 
     int level = 0;
-    if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
+    if ( (level <= Loglevel) )
     {
         ostringstream msg;
         msg << "Curl error while requesting following url: " << url << " Curl error code: " << curl_err_code << " " << curl_err << endl; /*lint !e641 */
-        log_warning(msg.str(),level);
+        log_error(msg.str());
     }
 }
 
@@ -1254,11 +1290,11 @@ void Logger::print_curl_error(const string& url, const CURLcode curl_err_code, c
         curl_err = "UNKNOWN";
 
     int level = 0;
-    if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
+    if ( (level <= Loglevel) )
     {
         ostringstream msg;
         msg << "Curl error while requesting following url: " << url << " Curl error code: " << curl_err_code << " " << curl_err << " " << curl_err_buff << endl; /*lint !e641 */
-        log_warning(msg.str(),level);
+        log_error(msg.str());
     }
 }
 
@@ -1288,11 +1324,11 @@ void Logger::print_curl_data(const string& curl_writedata_buff) const
 void Logger::print_service_not_authorized(const string& service, const string& username, const string& password) const
 {
     int level = 0;
-    if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
+    if ( level <= Loglevel )
     {
         ostringstream msg;
         msg << "Not authorized to perform update operation on service: " << service << " Please check username and password: " << username << ":" << password << endl;
-        log_warning(msg.str(),level);
+        log_notice(msg.str());
     }
 }
 
@@ -1322,11 +1358,11 @@ void Logger::print_http_status_code(const string& url, const long http_code) con
 void Logger::print_update_failure(const string& url, const string& curl_data) const
 {
     int level = 0;
-    if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
+    if ( (level <= Loglevel) )
     {
         ostringstream msg;
         msg << "Problem while trying to updating service. Requested URL: " << url << " Error Code from Server: " << curl_data << endl;
-        log_warning(msg.str(),level);
+        log_error(msg.str());
     }
 }
 
@@ -1339,11 +1375,11 @@ void Logger::print_update_failure(const string& url, const string& curl_data) co
 void Logger::print_update_failure(const string& url, const long http_status_code) const
 {
     int level = 0;
-    if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
+    if ( level <= Loglevel )
     {
         ostringstream msg;
         msg << "Problem while trying to updating service. Requested URL: " << url << " Error Code from Server: " << http_status_code << endl;
-        log_warning(msg.str(),level);
+        log_error(msg.str());
     }
 }
 
@@ -1351,7 +1387,7 @@ void Logger::print_update_failure(const string& url, const long http_status_code
  * Hostname is invalid, contains no or only one domain part.
  * @param hostname The full qualified host name. 
  */
-void Logger::print_invalid_hostname(const string& hostname) const
+void Logger::print_invalid_hostname(const string& hostname)
 {
     int level = 0;
     if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
@@ -1367,7 +1403,7 @@ void Logger::print_invalid_hostname(const string& hostname) const
  * An IP in a private range was detected
  * @param ip The private IP
  */
-void Logger::print_ip_is_local(const string& ip) const
+void Logger::print_ip_is_local(const string& ip)
 {
     int level = 1;
     if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
@@ -1401,7 +1437,7 @@ void Logger::print_regex_match(const string& regex, const string& matching_strin
  * @param regex Regex
  * @param not_matching_string String
  */
-void Logger::print_no_regex_match(const string& regex, const string& not_matching_string) const
+void Logger::print_no_regex_match(const string& regex, const string& not_matching_string)
 {
     int level = 1;
     if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
@@ -1420,11 +1456,11 @@ void Logger::print_no_regex_match(const string& regex, const string& not_matchin
 void Logger::print_could_not_parse_received_data(const string& curl_data) const
 {
     int level = 0;
-    if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
+    if ( (level <= Loglevel) )
     {
         ostringstream msg;
         msg << "Could not parse salt, time and sign from initial gnudip server reply: " << curl_data << endl;
-        log_warning(msg.str(),level);
+        log_error(msg.str());
     }
 }
 
@@ -1435,9 +1471,9 @@ void Logger::print_could_not_parse_received_data(const string& curl_data) const
 void Logger::print_could_not_get_initial_gnudip_data() const
 {
     int level = 0;
-    if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
+    if ( (level <= Loglevel) )
     {
-        log_warning("Could not get salt, time and sign from map.",level);
+        log_error("Could not get salt, time and sign from map.");
     }
 }
 
@@ -1446,7 +1482,7 @@ void Logger::print_could_not_get_initial_gnudip_data() const
 /**
  * Gnudip protocol requires explicit declaration of a servername.
  */
-void Logger::print_gnudip_requires_servername() const
+void Logger::print_gnudip_requires_servername()
 {
     int level = 0;
     if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
index 2f1b153..ba1ea6c 100644 (file)
@@ -27,6 +27,8 @@ private:
     bool Syslog;
     std::string ExternalWarningLog;
     int ExternalWarningLevel;
+    std::set<std::string> ExternalSendMessages;
+    bool ExternalLogOnlyOnce;
 
 public:
 
@@ -36,9 +38,13 @@ public:
 
     ~Logger();
 
+    void set_external_log_only_once( const bool _external_log_only_once );
+
+    void clear_external_send_messages();
+
     void log_notice(const std::string& msg) const;
 
-    void log_warning(const std::string& msg, int loglevel) const;
+    void log_warning(const std::string& msg, int loglevel);
 
     void log_error(const std::string& msg) const;
 
@@ -50,7 +56,7 @@ public:
 
     bool get_syslog() const;
 
-    void set_log_facility(const int _loglevel, const bool _syslog, const std::string& _external_error_log, const int _external_error_level);
+    void set_log_facility(const int _loglevel, const bool _syslog, const std::string& _external_error_log, const int _external_error_level, const bool _external_log_only_once );
 
     void print_usage(const boost::shared_ptr<boost::program_options::options_description> opt_desc) const;
 
@@ -132,7 +138,7 @@ public:
 
     void print_child_killed(const int pid) const;
 
-    void print_no_object_file(const std::string& object_file) const;
+    void print_no_object_file(const std::string& object_file);
 
     void print_hostname(const std::string& hostname) const;
 
@@ -144,11 +150,11 @@ public:
 
     void print_update_service_successful(const std::string& service) const;
 
-    void print_webcheck_no_ip() const;
+    void print_webcheck_no_ip();
 
     void print_no_wan_ip() const;
 
-    void print_webcheck_url_connection_problem(const char * curl_err_buff, const std::string& url) const;
+    void print_webcheck_url_connection_problem(const char * curl_err_buff, const std::string& url);
 
     void print_webcheck_error(const char * curl_err_buff, const std::string& url) const;
 
@@ -156,7 +162,7 @@ public:
 
     void print_regex_found_ip(const std::string& ip) const;
 
-    void print_regex_ip_not_found(const std::string& data) const;
+    void print_regex_ip_not_found(const std::string& data);
 
     void print_multiple_cmd_option(const std::string& message) const;
 
@@ -164,9 +170,9 @@ public:
 
     void print_multiple_main_conf_option(const std::string& main_conf_file, const std::string& message) const;
 
-    void print_update_not_allowed(const time_t current_time, const time_t old_time, const int MaxUpdatesWithinInterval, const std::string& service) const;
+    void print_update_not_allowed(const time_t current_time, const time_t old_time, const int MaxUpdatesWithinInterval, const std::string& service);
 
-    void print_update_service_failure(const std::string& service) const;
+    void print_update_service_failure(const std::string& service);
 
     void print_starting_shutdown() const;
 
@@ -194,7 +200,7 @@ public:
 
     void print_service_not_authorized(const std::string& service, const std::string& username, const std::string& password) const;
 
-    void print_service_not_initialized(const std::string& service) const;
+    void print_httphelper_not_initialized() const;
 
     void print_http_status_code(const std::string& url, const long http_code) const;
 
@@ -202,19 +208,19 @@ public:
 
     void print_update_failure(const std::string& url, const long http_status_code) const;
 
-    void print_invalid_hostname(const std::string& hostname) const;
+    void print_invalid_hostname(const std::string& hostname);
 
-    void print_ip_is_local(const std::string& ip) const;
+    void print_ip_is_local(const std::string& ip);
 
     void print_regex_match(const std::string& regex, const std::string& matching_string) const;
 
-    void print_no_regex_match(const std::string& regex, const std::string& not_matching_string) const;
+    void print_no_regex_match(const std::string& regex, const std::string& not_matching_string);
 
     void print_could_not_parse_received_data(const std::string& curl_data) const;
 
     void print_could_not_get_initial_gnudip_data() const;
 
-    void print_gnudip_requires_servername() const;
+    void print_gnudip_requires_servername();
 
     void print_exception_md5_sum(const std::string& what) const;
 
@@ -247,6 +253,8 @@ public:
     void print_error_getting_local_wan_ip(const std::string& system_call, const std::string& error) const;
 
     void print_invalid_service_config() const;
+
+    bool is_allowed_to_send( const std::string& msg ) const;
 };
 
 #endif
index bd56479..39c2295 100644 (file)
@@ -174,7 +174,7 @@ int ServiceDhs::perform_update(const std::string& ip)
     }
     else
     {
-        get_logger()->print_service_not_initialized(url);
+        get_logger()->print_httphelper_not_initialized();
     }
     return -1;
 }
index 56a62dc..abd1d4a 100644 (file)
@@ -133,7 +133,7 @@ int ServiceDyndns::perform_update(const std::string& ip)
     }
     else
     {
-        get_logger()->print_service_not_initialized(url);
+        get_logger()->print_httphelper_not_initialized();
     }
     return -1;
 }
index d1c90ee..10d4398 100644 (file)
@@ -140,7 +140,7 @@ int ServiceDyns::perform_update(const std::string& ip)
     }
     else
     {
-        get_logger()->print_service_not_initialized(url);
+        get_logger()->print_httphelper_not_initialized();
     }
     return -1;
 }
index 6e2d536..b90894e 100644 (file)
@@ -218,7 +218,7 @@ int ServiceEasydns::perform_update(const std::string& ip)
     }
     else
     {
-        get_logger()->print_service_not_initialized(url);
+        get_logger()->print_httphelper_not_initialized();
     }
     return -1;
 }
index b4fede5..2149509 100644 (file)
@@ -302,7 +302,7 @@ int ServiceGnudip::perform_update(const std::string& ip)
     }
     else
     {
-        get_logger()->print_service_not_initialized(BaseUrl);
+        get_logger()->print_httphelper_not_initialized();
     }
     return -1;
 }
index 346ae4d..01fa6b0 100644 (file)
@@ -140,7 +140,7 @@ int ServiceTzo::perform_update(const std::string& ip)
     }
     else
     {
-        get_logger()->print_service_not_initialized(url);
+        get_logger()->print_httphelper_not_initialized();
     }
     return -1;
 }
index 57bd1e7..f7c069e 100644 (file)
@@ -134,7 +134,7 @@ int ServiceZoneedit::perform_update(const std::string& ip)
     }
     else
     {
-        get_logger()->print_service_not_initialized(url);
+        get_logger()->print_httphelper_not_initialized();
     }
     return -1;
 }
index 648baef..b474264 100644 (file)
@@ -83,6 +83,9 @@ int Updater::reload_config()
     // delete the actual Variables_map, perhaps with old cmd options which would overwrite new config file options.
     Conf->delete_variables_map();
 
+    // clear the external send messages.
+    Log->clear_external_send_messages();
+
     // load only config files
     if ( init_config_from_files() != 0 )
         return -1;
@@ -205,7 +208,7 @@ Logger::Ptr Updater::get_logger() const
  */
 void Updater::init_log_facility() const
 {
-    Log->set_log_facility(Conf->get_loglevel(),Conf->get_syslog(),Conf->get_external_warning_log(),Conf->get_external_warning_level());
+    Log->set_log_facility(Conf->get_loglevel(),Conf->get_syslog(),Conf->get_external_warning_log(),Conf->get_external_warning_level(),Conf->get_external_log_only_once());
     Log->print_init_log_facility();
 }