diff --git a/library/logger/logger.cc b/library/logger/logger.cc index ff64a21..2bafa05 100644 --- a/library/logger/logger.cc +++ b/library/logger/logger.cc @@ -37,7 +37,12 @@ namespace scarab spd_initializer( a_pattern ), f_sink() { - spdlog::init_thread_pool(8192, 1); + // We check before creating the new thread pool because we've had problems in some situations (e.g. when started from Python) + // with a new thread pool being created and the old one being killed, resulting in strange errors during execution + if( ! spdlog::thread_pool() ) + { + spdlog::init_thread_pool(8192, 1); + } f_sink = std::make_shared< spdlog::sinks::stdout_color_sink_mt >(); f_sink->set_pattern( f_pattern ); auto at_exit_fcn = [](){ logger::stop_using_spd_async(); }; @@ -201,7 +206,7 @@ namespace scarab void logger::reset_using_spd_async() { #ifdef SCARAB_LOGGER_DEBUG - std::cerr << "Resetting use of spd async" << std::endl; + std::cerr << "[logger::reset_using_spd_async()] Resetting use of spd async" << std::endl; #endif logger::using_spd_async().store(true); std::set< logger* >& t_all_loggers = logger::all_loggers(); diff --git a/library/logger/logger.hh b/library/logger/logger.hh index 3e7bbf8..cd68d2d 100644 --- a/library/logger/logger.hh +++ b/library/logger/logger.hh @@ -188,7 +188,7 @@ namespace scarab f_initializer_ptr( nullptr ) { #ifdef SCARAB_LOGGER_DEBUG - std::cout << "Logger <" << a_name << "> was initialized from <" << a_file << ":" << a_line << ">; type: " << ::scarab::type( *this ) << std::endl; + std::cerr << "[logger_type constructor] Logger <" << a_name << "> was initialized from <" << a_file << ":" << a_line << ">; type: " << ::scarab::type( *this ) << std::endl; #endif // Start the backend, but only once static initializer_x s_init;