Composer issue with boost::log::sinks::event_log on VS2010
Hello, I use basic_event_log_backend according to documentationhttp://www.boost.org/doc/libs/1_55_0/libs/log/doc/html/log/detailed/sink_bac...- I add formatters to events with event_composer: sinks::event_log::event_composer composer( sinks::event_log::direct_event_id_mapping<int>("EventId") ); composer[MSG1] % expr::attr<WORD>("Tag1"); composer[MSG2] % expr::attr<DWORD>("Tag2"); composer[MSG3] % expr::attrstd::string("Tag3"); backend->set_event_composer(composer); 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, formatter_type(fmt)); return *this; } and call it explicitly, so the code looks like that: composer[MSG1].add_formatter(expr::attr<WORD>("Tag1")); composer[MSG2].add_formatter(expr::attr<DWORD>("Tag2")); composer[MSG3].add_formatter(expr::attrstd::string("Tag3")); 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? Regards, Konrad.
participants (1)
-
Konrad Rybacki