Menu

Windows event_composer formatters not being set? (1.57.0.0)

Help
2016-05-24
2016-05-26
  • Eduardo Navarro

    Eduardo Navarro - 2016-05-24

    Hi,

    I've been going around this for quite a bit. I can get the logging to emit events to the log, but the messages come out with the %n notation. I tried numerous things with no success. Im using a global logger and setting tags on a per-thread basis.

    My message text is good, messages and event IDs are properly interpreted. I get the messages output with %1 and the EventData is empty. As an example, my genering info message is INFO %1 where %1 should be whatever message I logged.

    I do a pretty vanilla global logger, and my current focus is composer. Below is how I initialize it:
    BOOST_LOG_GLOBAL_LOGGER_INIT(akv_global_logger, src::severity_logger_mt)
    {
    //#define EVENT_LOG_ID_TAG "EventID"
    //#define EVENT_LOG_GENERIC_MSG_TAG "Message"
    //TRUNCATED INITIALIZATION OF backend, type mapping, and category mapping.
    sinks::event_log::event_composer composer(
    sinks::event_log::direct_event_id_mapping< int >(EVENT_LOG_ID_TAG));
    composer[AKV_MSG_GENERICINFO]
    % expr::attr< attrs::current_process_id::value_type >("ProcessId")
    % expr::attr< std::string >(EVENT_LOG_GENERIC_MSG_TAG);
    boost::shared_ptr< sinks::synchronous_sink< sinks::event_log_backend > > sink(
    new sinks::synchronous_sink< sinks::event_log_backend >(backend));
    sink->locked_backend()->set_event_composer(composer);
    logging::core::get()->add_sink(sink);
    logging::core::get()->add_global_attribute("ProcessId", attrs::current_process_id());
    }

    For some reason, the composer's m_EventMap is empty after adding the formatters (I have a couple more). Can anyone help?

     
  • Eduardo Navarro

    Eduardo Navarro - 2016-05-24

    Could really use the help here :)

     
  • Andrey Semashev

    Andrey Semashev - 2016-05-25

    For some reason, the composer's m_EventMap is empty after adding the formatters

    I don't know how that can happen, given that operator[] and operator% in the composer fill m_EventMap. Maybe you have some ABI mismatch? You'll have to step through in the debugger to see what is happening. What compiler are you using?

     
  • Eduardo Navarro

    Eduardo Navarro - 2016-05-25

    Im using VS 2013. I ran debugger, and it was not populating the m_EventMap object. The m_EventIDMapper is properly initialized. Events are being fired and logged, just that there is no formatting.

     
  • Eduardo Navarro

    Eduardo Navarro - 2016-05-26

    The tests I'm doing are running under the Boost UTF, not sure if that matters. I tried MBCS and UNICODE, no difference. m_EventMap is empty.

     

Log in to post a comment.