-1

Boost log causes my application to crash when I run out of disk space.

It also crashes if I open an active log file in excel and it tries to rollover the file when excel has it open.

It is pretty awful that my application crashes due to the logging. It should just fail silently. From the dump it looks like an unhandled exception.

How can I make it fail silently rather than crash my application?

I am using boost trvial logger and configuring it like so:

    boost::log::add_file_log(
        boost::log::keywords::file_name = "foo.log",
        boost::log::keywords::target = C:\\log",
        boost::log::keywords::rotation_size = 100000,
        boost::log::keywords::max_size = 10 * 100000,
        boost::log::keywords::auto_flush = true,
        boost::log::keywords::format = "%TimeStamp%,%Message%",
        boost::log::keywords::time_based_rotation = boost::log::sinks::file::rotation_at_time_point(0, 0, 0)
    );
2
  • What exception? Thrown from where?
    – user3458
    Commented Jul 24, 2018 at 12:50
  • it thows in the logger when it tries to roll over the log files. See my answer below
    – deltanine
    Commented Mar 18, 2019 at 1:10

1 Answer 1

2

You have to tell boost log to suppress exceptions, like so:

boost::log::core::get()->set_exception_handler(boost::log::make_exception_suppressor());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.