Boost C++ Libraries: Ticket #12600: Syslog broken in 1.62.0 https://svn.boost.org/trac10/ticket/12600 <p> Hello, </p> <p> syslog seems to be broken in 1.62.0. </p> <p> 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. </p> <p> Can anybody confirm this behaviour? </p> <p> Operating system: <a class="missing wiki">RedHat</a> 7.1 Boost compiled using GCC 4.8.3-9 with BOOST_LOG_DYN_LINK </p> <p> Thanks </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12600 Trac 1.4.3 Andrey Semashev Thu, 10 Nov 2016 11:04:32 GMT <link>https://svn.boost.org/trac10/ticket/12600#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12600#comment:1</guid> <description> <p> 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. </p> </description> <category>Ticket</category> </item> <item> <author>mario.m.kaip@…</author> <pubDate>Thu, 10 Nov 2016 14:28:28 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/12600 https://svn.boost.org/trac10/ticket/12600 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">main.cpp</span> </li> </ul> <p> Minimal example for syslog </p> Ticket mario.m.kaip@… Thu, 10 Nov 2016 14:29:06 GMT attachment set https://svn.boost.org/trac10/ticket/12600 https://svn.boost.org/trac10/ticket/12600 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">strace_1.61.0.log</span> </li> </ul> <p> strace of example using boost 1.61.0 </p> Ticket mario.m.kaip@… Thu, 10 Nov 2016 14:29:27 GMT attachment set https://svn.boost.org/trac10/ticket/12600 https://svn.boost.org/trac10/ticket/12600 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">strace_1.62.0.log</span> </li> </ul> <p> strace of example using boost 1.62.0 </p> Ticket anonymous Thu, 10 Nov 2016 14:34:29 GMT <link>https://svn.boost.org/trac10/ticket/12600#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12600#comment:2</guid> <description> <p> I created a minimal example for syslog using code from <a href="http://www.boost.org/doc/libs/1_62_0/libs/log/doc/html/log/detailed/sink_backends.html">http://www.boost.org/doc/libs/1_62_0/libs/log/doc/html/log/detailed/sink_backends.html</a> </p> <p> Minimal example: </p> <pre class="wiki">#define BOOST_LOG_DYN_LINK #define BOOST_LOG_USE_NATIVE_SYSLOG #include &lt;boost/log/core.hpp&gt; #include &lt;boost/log/sources/logger.hpp&gt; #include &lt;boost/smart_ptr/shared_ptr.hpp&gt; #include &lt;boost/log/common.hpp&gt; #include &lt;boost/log/sinks/sync_frontend.hpp&gt; #include &lt;boost/log/sinks/syslog_backend.hpp&gt; // Complete sink type typedef boost::log::sinks::synchronous_sink&lt; boost::log::sinks::syslog_backend &gt; 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&lt; logging::core &gt; core = logging::core::get(); // Create a backend boost::shared_ptr&lt; sinks::syslog_backend &gt; 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-&gt;set_severity_mapper(sinks::syslog::direct_severity_mapping&lt; int &gt;("Severity")); // Wrap it into the frontend and register in the core. // The backend requires synchronization in the frontend. core-&gt;add_sink(boost::make_shared&lt; sink_t &gt;(backend)); } int main(int argc, char** argv) { init_native_syslog(); sources::logger logger; BOOST_LOG(logger) &lt;&lt; "TEST_SYSLOG"; return 0; } </pre><p> Compiled with Intel compiler: </p> <p> icpc -m64 -c -g -Ideps/include -std=c++11 -MMD -MP -MF "main.o.d" -o main.o main.cpp </p> <p> icpc -m64 -o syslog-testprogram main.o -Ldeps/libs -Wl,-rpath,'deps/libs' -lboost_log -lboost_log_setup -lboost_system -lboost_thread </p> <p> 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. </p> </description> <category>Ticket</category> </item> <item> <author>mario.m.kaip@…</author> <pubDate>Thu, 10 Nov 2016 14:43:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12600#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12600#comment:3</guid> <description> <p> Also tested with GCC 4.8.3. Same result, no syslog with Boost 1.62.0. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Thu, 10 Nov 2016 15:46:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12600#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12600#comment:4</guid> <description> <p> As you can see in the strace output, the process does send your message (see the last <code>sendmsg</code> call with string "&lt;14&gt; 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 <a class="ext-link" href="https://github.com/boostorg/log/commit/084f848d1461f16c0a6871694076aa36995d4f80"><span class="icon">​</span>https://github.com/boostorg/log/commit/084f848d1461f16c0a6871694076aa36995d4f80</a> and <a class="ext-link" href="https://github.com/boostorg/log/commit/d595b6de33c85ec3bf7c81fc2eb5c4537bdfd786"><span class="icon">​</span>https://github.com/boostorg/log/commit/d595b6de33c85ec3bf7c81fc2eb5c4537bdfd786</a>). </p> <p> 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. <code>BOOST_LOG_USE_NATIVE_SYSLOG</code> 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 <code>BOOST_LOG_USE_NATIVE_SYSLOG</code> defined and see if that helps. </p> </description> <category>Ticket</category> </item> <item> <author>mario.m.kaip@…</author> <pubDate>Thu, 10 Nov 2016 16:43:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12600#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12600#comment:5</guid> <description> <p> Thank you for this helpful comment. I builded Boost 1.62.0 with BOOST_LOG_USE_NATIVE_SYSLOG and everythink works fine. </p> <p> Is this only a workaround for 1.62.0 or is this the intended usage in future boost releases? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Thu, 10 Nov 2016 16:52:03 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12600#comment:6 https://svn.boost.org/trac10/ticket/12600#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I've re-implemented native syslog detection in <a class="ext-link" href="https://github.com/boostorg/log/commit/299603ff024c6eaf73d9f52818faab7e7ac81ba0"><span class="icon">​</span>https://github.com/boostorg/log/commit/299603ff024c6eaf73d9f52818faab7e7ac81ba0</a>. If everything goes fine, it'll be released in 1.63 and you won't have to define the macro yourself. </p> Ticket