Ok, thank you for the input.
Hi, yes, I agree the library should not terminate but I was wondering if you had a suggestion on the best way to implement the termination. We have tried a callback to std::terminatewith a call to core::flush() and nothing is output to the logs. We have done this with special macro for the fatal severity. We would prefer to not have a special macro. I thought you might have a suggestion on the best way to implement such a feature using features of the library. Thanks
Well, for one thing the program keeps running. :-) We would like FATAL to call abort or terminate after the log message is written and all the log messages are flushed. Unless we missed something, the log library does not do this for you.
Hi, I was wondering if you have any suggestions on how to correctly implement a fatal log message using the multi-threaded severity logger without creating a special macro for the FATAL condition. Thank you.
Thank you. That does solve the issue.
Continuation of thread: https://sourceforge.net/p/boost-log/discussion/710022/thread/555365ac/?limit=25 Compiled boost 1.80 library using gcc: gcc --version gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0 ./bootstrap.sh sudo ./b2 release link=shared cxxflags=-fPIC cflags=-fPIC -a install Modified boost_1_77_0/libs/log/example/advanced_usage/main.cpp to have some threads. See attached file. Compiled with using thread sanitizer: Ubuntu clang version 14.0.6-++20220622053133+f28c006a5895-1~exp1~20220622173215.107...
Sorry about the off topic post, but it did relate to an earlier post about using the wrap_formatter and getting a race condition. I upgraded to 1.80 and still can reproduce the data race using log/example/advanced_usage/main.cpp with some minor modifications described above.
Hi, to show the data race I modified the following example program: boost_1_77_0/libs/log/example/advanced_usage/main.cpp I added the following functions: void f1(int n, src::severity_logger_mt<severity_level>& slg) { for (int i = 0; i < 25; ++i) { BOOST_LOG_SEV(slg, error) << "Thread 1 executing " << i; ++n; std::this_thread::sleep_for(std::chrono::milliseconds(10)); } } void f2(int& n, src::severity_logger_mt<severity_level>& slg) { BOOST_LOG_SCOPED_LOGGER_TAG(slg, "Tag", "Tagged f2 "); for (int...