Boost logo

Boost Users :

Subject: [Boost-users] boost::log native syslog sink.
From: svante karlsson (saka_at_[hidden])
Date: 2014-10-01 12:30:50


I'm using ubuntu 14.04 with the included boost 1.54 and I'm trying to set
up a syslog sink.

I've cut this from the samples and added "ident".

void init_syslog()
{
    boost::shared_ptr< boost::log::core > core = boost::log::core::get();

    // Create a backend
    boost::shared_ptr< sinks::syslog_backend > backend(new
sinks::syslog_backend(
        keywords::facility = sinks::syslog::local0,
        keywords::use_impl = sinks::syslog::native,
        keywords::ident = "mqtt-proxy"
        ));

    // Set the straightforward level translator for the "Severity"
attribute of type int
    backend->set_severity_mapper(sinks::syslog::direct_severity_mapping<
int >("Severity"));

    // Wrap it into the frontend and register in the core.
    // The backend requires synchronization in the frontend.
    core->add_sink(boost::make_shared< sink_t >(backend));
}

The logs end up in syslog but I cant prefix those by program name (and
processnumber ) - I've expected the logs to be marked as 'mqtt-proxy'

I get logs like
Sep 29 03:47:40 ubuntu : ad569c57-780a-431b-bde3-7ede49e7c77f, bridge create

but what I would like is similar to
Sep 29 03:47:40 ubuntu mqtt-proxy: ad569c57-780a-431b-bde3-7ede49e7c77f,
bridge create

Am I missing something or is ident not supported?

/svante



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net