Opened 5 years ago

Last modified 5 years ago

#13257 new Bugs

Log attributes passed as arguments to open_record are ignored

Reported by: Thomas M. Bernal <tbernal@…> Owned by: Andrey Semashev
Milestone: To Be Determined Component: log
Version: Boost 1.64.0 Severity: Not Applicable
Keywords: open_record basic_logger open_record_unlocked Cc:

Description

Why does boost::log::sources::basic_logger::open_record_unlocked(ArgsT const&) ignore its argument when calling boost::log::core::open_record()?

    /*!
     * Unlocked \c open_record
     */
    template< typename ArgsT >
    record open_record_unlocked(ArgsT const&)
    {
        return m_pCore->open_record(m_Attributes);
    }

The boost::log::sources::logger_mt::open_record() eventually passes the attributes to this function where they are summarily ignored. How is something as fundamental to the Boost Log library as BOOST_LOG_WITH_PARAMETERS() supposed to work! It doesn't, by the way.

Change History (3)

comment:1 by Thomas M. Bernal <tbernal@…>, 5 years ago

It seems the severity_logger cheats!

    record open_record_unlocked(ArgsT const& args)
    {
        m_SeverityAttr.set_value(args[keywords::severity | m_DefaultSeverity]);
        return base_type::open_record_unlocked(args);
    }

So you are telling me that if I want to add attributes in the call to open_record that I need to implement my own logger and cheat? This is not the way the library appears to be in the tutorial. The tutorial makes it seem that anything passed into open_record will get combined with the logger's attributes before being sent to the core. This is not only very deceiving but highly cryptic.

comment:2 by Thomas M. Bernal <tbernal@…>, 5 years ago

Never mind. They're parameters not attributes. That was not clear from the documentation, and my not being familiar with boost parameters.

comment:3 by Thomas M. Bernal <tbernal@…>, 5 years ago

Severity: ShowstopperNot Applicable
Note: See TracTickets for help on using tickets.