Boost logo

Boost Users :

Subject: [Boost-users] Composer issue with boost::log::sinks::event_log on VS2010
From: Konrad Rybacki (konrad.rybacki_at_[hidden])
Date: 2014-03-11 10:23:23


I use basic_event_log_backend according to
I add formatters to events with

    sinks::event_log::event_composer composer(

    composer[MSG1] % expr::attr<WORD>("Tag1");
    composer[MSG2] % expr::attr<DWORD>("Tag2");
    composer[MSG3] % expr::attr<std::string>("Tag3");


Unfortunately event log entries in event viewer are incomplete - i.e.
there are still "%n"
placeholders instead of their values. From what I have found while
inspecting the code
with debugger it seems that event_map_reference& operator% (FormatterT
const& fmt)is never hit - so m_EventMap in composer is empty. I added
a method that works the same way
as mentioned operator:

            template< typename FormatterT >
            event_map_reference& add_formatter(FormatterT const &fmt)
                m_Composer = m_Owner.add_formatter(m_ID, m_Composer,
                return *this;

 and call it explicitly, so the code looks like that:


Now m_EventMap has three items - and I get empty strings instead of
"%n" in event viewer.
I pass the tag values with boost macro, i.e.:

    BOOST_LOG_SCOPED_THREAD_TAG("Tag3", std::string("value"));

I am using Visual Studio 2010 compiler. Any ideas?



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at