From 50e1848189f5c4f8619549cfb6c2dbb25bb832c5 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 27 Jun 2019 21:55:21 -0500 Subject: [PATCH 1/4] Update to fc and appbase with sighup logging fixes --- libraries/appbase | 2 +- libraries/fc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/appbase b/libraries/appbase index b6b55f5ff99..25e2b4d28d2 160000 --- a/libraries/appbase +++ b/libraries/appbase @@ -1 +1 @@ -Subproject commit b6b55f5ff993f4be954d2aa556538636fbdaabb4 +Subproject commit 25e2b4d28d2410a14e62b1dd70f3b0ca8155e956 diff --git a/libraries/fc b/libraries/fc index 5ac1fd76872..b7a1ded6e6c 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 5ac1fd7687261511c4a6a1866c5ade4b867390f8 +Subproject commit b7a1ded6e6ce025d177db0486d2e594e9f8865ea From 188612e67ed0c895d2aeaee87ec7177a3355df8e Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 27 Jun 2019 16:53:46 -0500 Subject: [PATCH 2/4] Call new fc::log_config::initialize_appenders --- programs/nodeos/main.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/programs/nodeos/main.cpp b/programs/nodeos/main.cpp index 04c726ed8df..e4c77d91169 100644 --- a/programs/nodeos/main.cpp +++ b/programs/nodeos/main.cpp @@ -21,10 +21,6 @@ using namespace appbase; using namespace eosio; -namespace fc { - std::unordered_map& get_appender_map(); -} - namespace detail { void configure_logging(const bfs::path& config_path) @@ -51,12 +47,11 @@ void configure_logging(const bfs::path& config_path) void logging_conf_handler() { - ilog("Received HUP. Reloading logging configuration."); auto config_path = app().get_logging_conf(); + ilog("Received HUP. Reloading logging configuration from ${p}.", ("p", config_path.string())); if(fc::exists(config_path)) ::detail::configure_logging(config_path); - for(auto iter : fc::get_appender_map()) - iter.second->initialize(app().get_io_service()); + fc::log_config::initialize_appenders( app().get_io_service() ); } void initialize_logging() @@ -64,8 +59,7 @@ void initialize_logging() auto config_path = app().get_logging_conf(); if(fc::exists(config_path)) fc::configure_logging(config_path); // intentionally allowing exceptions to escape - for(auto iter : fc::get_appender_map()) - iter.second->initialize(app().get_io_service()); + fc::log_config::initialize_appenders( app().get_io_service() ); app().set_sighup_callback(logging_conf_handler); } From d20694bb4c969c7f84cfbcf685c5b99027979e31 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 27 Jun 2019 16:53:32 -0500 Subject: [PATCH 3/4] Use new fc::logger::update to update logger --- plugins/net_plugin/net_plugin.cpp | 7 +------ plugins/producer_plugin/producer_plugin.cpp | 15 ++------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 9dcb9ef5b6b..106d6094fba 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -30,10 +30,6 @@ using namespace eosio::chain::plugin_interface::compat; -namespace fc { - extern std::unordered_map& get_logger_map(); -} - namespace eosio { static appbase::abstract_plugin& _net_plugin = app().register_plugin(); @@ -3077,8 +3073,7 @@ namespace eosio { } void net_plugin::handle_sighup() { - if(fc::get_logger_map().find(logger_name) != fc::get_logger_map().end()) - logger = fc::get_logger_map()[logger_name]; + fc::logger::update( logger_name, logger ); } void net_plugin::plugin_shutdown() { diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index ab9f5c8aa91..7f9ae952cdd 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -43,12 +43,6 @@ using std::vector; using std::deque; using boost::signals2::scoped_connection; -// HACK TO EXPOSE LOGGER MAP - -namespace fc { - extern std::unordered_map& get_logger_map(); -} - const fc::string logger_name("producer_plugin"); fc::logger _log; @@ -875,13 +869,8 @@ void producer_plugin::plugin_shutdown() { } void producer_plugin::handle_sighup() { - auto& logger_map = fc::get_logger_map(); - if(logger_map.find(logger_name) != logger_map.end()) { - _log = logger_map[logger_name]; - } - if( logger_map.find(trx_trace_logger_name) != logger_map.end()) { - _trx_trace_log = logger_map[trx_trace_logger_name]; - } + fc::logger::update( logger_name, _log ); + fc::logger::update( trx_trace_logger_name, _trx_trace_log ); } void producer_plugin::pause() { From b15c93b88054153b935f5fc7ca3ac703eedc3167 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 27 Jun 2019 22:01:05 -0500 Subject: [PATCH 4/4] Update to 1.8 versions of fc and appabase with sighup logging fixes --- libraries/appbase | 2 +- libraries/fc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/appbase b/libraries/appbase index 25e2b4d28d2..d864831e7b1 160000 --- a/libraries/appbase +++ b/libraries/appbase @@ -1 +1 @@ -Subproject commit 25e2b4d28d2410a14e62b1dd70f3b0ca8155e956 +Subproject commit d864831e7b12639e9f63fe721b9d4ae225e03fb0 diff --git a/libraries/fc b/libraries/fc index b7a1ded6e6c..6593ef120a7 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit b7a1ded6e6ce025d177db0486d2e594e9f8865ea +Subproject commit 6593ef120a79d97e3274a986acc84b3741a15de9