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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's not the logging library's job to terminate the application. If you want to terminate then go ahead and do that - in the application. You may want to call core::flush() to make sure all log records are processed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A special macro or function seems like the right way to go. Terminating from within the library will not guarantee that all log records are processed. Also, calling core::flush() from an atexit handler won't work because the library is likely terminated at this stage.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
What's wrong with
BOOST_LOG_SEV(lg, fatal) << "Good bye cruel world"
?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.
It's not the logging library's job to terminate the application. If you want to terminate then go ahead and do that - in the application. You may want to call
core::flush()
to make sure all log records are processed.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::terminate
with a call tocore::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. ThanksA special macro or function seems like the right way to go. Terminating from within the library will not guarantee that all log records are processed. Also, calling
core::flush()
from anatexit
handler won't work because the library is likely terminated at this stage.Ok, thank you for the input.