Boost logo

Boost Users :

Subject: [Boost-users] [log] calling init_from_stream() or init_from_settings() more than once (reinitialize at runtime)
From: Oskar Nordquist (oskar.nordquist_at_[hidden])
Date: 2010-08-19 17:09:48


Hello,
I've just started experimenting with the unofficial Boost.Log by
Andrey Semashev.

I would like to know the defined behaviour of calling
init_from_stream() and init_from_settings() more than once, i.e. is it
possible to re-initialize with new settings at run time?

Basically I would like to do this:

    boost::log::settings setts;

    setts["Sink:File"]["Filter"] = "%Severity% > 4";
    setts["Sink:File"]["Destination"] = "TextFile";
    setts["Sink:File"]["FileName"] = "MyApp_%3N.log";
    setts["Sink:File"]["AutoFlush"] = true;
    setts["Sink:File"]["RotationSize"] = 10 * 1024 * 1024; // 10 MiB
    boost::log::init_from_settings(setts);

     // ... later on change severity filter to >= 0

    setts["Sink:File"]["Filter"] = "%Severity% >= 0";
    boost::log::init_from_settings(setts);

This does not work. It seems I am able to add new sinks without
problem, but modifying existing sinks is not possible.

I think that being able to reinitialize at runtime is an absolutely
vital feature. Being able to change a settings file and then just
reinit to turn on logging! Please tell me this is already supported
and I am doing something wrong, or at least that this will be
supported in the future :)

Regards,
Oskar


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net