Thank you Oskar!

2010/8/20 Oskar Nordquist <oskar.nordquist@gmail.com>
2010/8/20 Olivier Tournaire <olitour@gmail.com>

2010/8/20 Oskar Nordquist <oskar.nordquist@gmail.com>

Hi,

Just a wild guess:

Since the difference between your test program and the Boost example is that you are doing all the preparations in the constructor, whilst Boost example has everything in the main() scope. My guess is something goes out of scope at the end of the constructor, and some attribute is unregistered and thus generates "missing attribute" exception.

Maybe it is a problem with the singleton? No one experienced such a problem?
I tried a really simple program found in the documentation (http://boost-log.sourceforge.net/libs/log/doc/html/log/detailed/attributes.html#log.detailed.attributes.timer) which uses a class. The result is the same: it throws the same exception in the destructor.

 
I tried it on MSVC 10 as well and it throws the same exception. I even did a boolean formatter checking if the attribute exists:

    backend->set_formatter(
        fmt::stream
            << fmt::if_(flt::has_attr("Duration"))
            [
                fmt::stream << "Duration: " << fmt::attr("Duration")
            ]
            << "\tMsg: " << fmt::message());

Still throws the same exception.

I switched the attribute to a attrs::counter<int> and it works as expected.

Seems like attrs::timer is broken!

Seems you are right. Commenting the line
<< "] [" << fmt::time_duration< boost::posix_time::time_duration >("Uptime")
makes the sample work.
Should a bug report be open?

Regards,

Olivier
 

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users