Boost C++ Libraries: Ticket #12391: Visual Studio 2010 hangs up when linking boost log object https://svn.boost.org/trac10/ticket/12391 <p> I am using Visual Studio 2010 with SP1. I met a very strange problem: Visual Studio 2010 hangs up when linking boost log object. There is a work-around -- stop the building and restart it. Then it will success. </p> <p> I found if I set the second parameter "start_thread" to false in my sink ctor, and start thread explicitly, this problem disappears. But the second problem appears -- the application hangs up at run time. I have to remove the line "fileSink-&gt;run();". Then it does not hang up in either building and run time. </p> <p> My question is if I does not start thread for asynchronous_sink, is there any problem or any impact to the performance? Any way, I can still see the log record. Thank you. </p> <pre class="wiki"> typedef boost::log::sinks::asynchronous_sink&lt; boost::log::sinks::text_file_backend &gt; text_sink; boost::shared_ptr&lt; text_sink &gt; fileSink; boost::shared_ptr&lt; sinks::text_file_backend &gt; backend = boost::make_shared&lt; sinks::text_file_backend &gt;( boost::log::keywords::file_name = filePath, boost::log::keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0) //file rotation every day at midnight ); fileSink.reset(new text_sink(backend, false)); // hangs up during linking object, if set to true //fileSink-&gt;run(); // hangs up during rum time </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12391 Trac 1.4.3 Andrey Semashev Fri, 12 Aug 2016 15:33:00 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/12391#comment:1 https://svn.boost.org/trac10/ticket/12391#comment:1 <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">invalid</span> </li> </ul> <p> <code>run()</code> should be called in the dedicated thread that is supposed to process log records. When you pass <code>start_thread = true</code> that's effectively what the internal feeding thread does. If you don't start the internal thread, don't call <code>run</code> or <code>feed_records</code> then your log records will pile up in the queue not being processed. </p> <p> Regarding the compiler hang I suggest you report it to Microsoft. </p> Ticket xinyan.zhang@… Fri, 12 Aug 2016 18:25:57 GMT <link>https://svn.boost.org/trac10/ticket/12391#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12391#comment:2</guid> <description> <p> Without "start_thread=true" or explicitly call "run" or "feed_records", I still get the log record. That is strange. Is that log record incorrect or truncated? </p> <p> Thank you very much. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Fri, 12 Aug 2016 19:02:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12391#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12391#comment:3</guid> <description> <p> You could also be calling <code>flush()</code> which forces the buffered records to be processed at the point of this call. Other than that I can't see how records could appear in the output. </p> <p> BTW, <code>start_thread</code> is <code>true</code> by default, you have to explicitly set it to <code>false</code> to disable the internal thread. </p> </description> <category>Ticket</category> </item> <item> <author>xinyan.zhang@…</author> <pubDate>Fri, 12 Aug 2016 19:33:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12391#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12391#comment:4</guid> <description> <p> Yes, my code explicitly calls "flush()" periodically. That's the reason. Thank you very much. </p> </description> <category>Ticket</category> </item> </channel> </rss>