Ticket #12600 (closed Bugs: fixed)

Opened 2 months ago

Last modified 2 months ago

Syslog broken in 1.62.0

Reported by: mario.m.kaip@… Owned by: andysem
Milestone: To Be Determined Component: log
Version: Boost 1.62.0 Severity: Showstopper
Keywords: Cc:



syslog seems to be broken in 1.62.0.

I tried to use native and UDP based syslog to localhost which was fine in 1.61.0. In 1.62.0 no exceptions are thrown no log message arrives syslog.

Can anybody confirm this behaviour?

Operating system: RedHat? 7.1 Boost compiled using GCC 4.8.3-9 with BOOST_LOG_DYN_LINK



main.cpp Download (1.4 KB) - added by mario.m.kaip@… 2 months ago.
Minimal example for syslog
strace_1.61.0.log Download (41.8 KB) - added by mario.m.kaip@… 2 months ago.
strace of example using boost 1.61.0
strace_1.62.0.log Download (42.6 KB) - added by mario.m.kaip@… 2 months ago.
strace of example using boost 1.62.0

Change History

comment:1 Changed 2 months ago by andysem

You'll have to do some debugging in order to have suggestions. First, run your code under strace and see if the messages are being sent to the syslog service. If not, verify that your filters don't discard log records. If they don't, please attach a minimal compilable code sample that reproduces the problem.

Changed 2 months ago by mario.m.kaip@…

Minimal example for syslog

Changed 2 months ago by mario.m.kaip@…

strace of example using boost 1.61.0

Changed 2 months ago by mario.m.kaip@…

strace of example using boost 1.62.0

comment:2 Changed 2 months ago by anonymous

I created a minimal example for syslog using code from

Minimal example:


#include <boost/log/core.hpp>
#include <boost/log/sources/logger.hpp>

#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/log/common.hpp>
#include <boost/log/sinks/sync_frontend.hpp>
#include <boost/log/sinks/syslog_backend.hpp>

// Complete sink type
typedef boost::log::sinks::synchronous_sink< boost::log::sinks::syslog_backend > sink_t;

namespace logging  = boost::log;
namespace sinks    = boost::log::sinks;
namespace keywords = boost::log::keywords;
namespace sources  = boost::log::sources;

void init_native_syslog()
    boost::shared_ptr< logging::core > core = logging::core::get();

    // Create a backend
    boost::shared_ptr< sinks::syslog_backend > backend(new sinks::syslog_backend(
        keywords::facility = sinks::syslog::user,
        keywords::use_impl = sinks::syslog::native

    // 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));

int main(int argc, char** argv) {
    sources::logger logger;
    BOOST_LOG(logger) << "TEST_SYSLOG";
    return 0;

Compiled with Intel compiler:

icpc -m64 -c -g -Ideps/include -std=c++11 -MMD -MP -MF "main.o.d" -o main.o main.cpp

icpc -m64 -o syslog-testprogram main.o -Ldeps/libs -Wl,-rpath,'deps/libs' -lboost_log -lboost_log_setup -lboost_system -lboost_thread

Boost is located in ./deps relative to main.cpp. The strace produced with boost 1.61.0 and 1.62.0 is attached. I can't see useful information there.

comment:3 Changed 2 months ago by mario.m.kaip@…

Also tested with GCC 4.8.3. Same result, no syslog with Boost 1.62.0.

comment:4 Changed 2 months ago by andysem

As you can see in the strace output, the process does send your message (see the last sendmsg call with string "<14> Nov 10 15:10:56 WS14 TEST_"...). The message format is slightly different from the other log, but that's fixed in 1.63 (see and

The strace log also indicates that UDP socket-based backend is used even when you specify native. This can happen if support for native syslog was not compiled in (i.e. BOOST_LOG_USE_NATIVE_SYSLOG was not defined when Boost was built). I think, this could have changed in 1.62, and needs to be fixed. If that's the case, and your syslog daemon is not configured to listen for UDP packets, then the messages are lost. You can try rebuilding Boost and your code with BOOST_LOG_USE_NATIVE_SYSLOG defined and see if that helps.

comment:5 Changed 2 months ago by mario.m.kaip@…

Thank you for this helpful comment. I builded Boost 1.62.0 with BOOST_LOG_USE_NATIVE_SYSLOG and everythink works fine.

Is this only a workaround for 1.62.0 or is this the intended usage in future boost releases?

comment:6 Changed 2 months ago by andysem

  • Status changed from new to closed
  • Resolution set to fixed

I've re-implemented native syslog detection in If everything goes fine, it'll be released in 1.63 and you won't have to define the macro yourself.


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.