Boost C++ Libraries: Ticket #12684: Application crashing when collector maximum size is reached https://svn.boost.org/trac10/ticket/12684 <p> 0 down vote favorite I am using BOOST for my Logger API. I have a scenario when the maximum size of collector is reached it should stop logging. but currently the application is crashing. </p> <p> Example: maximum size of collector = 10MB and Maximum file size =4MB so it generates two files with size 4MB each and 1 with 2MB and the application should stop but its crashing here. </p> <p> Code is given below: sink = boost::make_shared&lt;file_sink&gt;(keywords::file_name = file_name, </p> <blockquote> <p> keywords::rotation_size = m_maxLogFileSize, keywords::open_mode = std::ios_base::out | std::ios_base::app, keywords::auto_flush = true ); </p> </blockquote> <p> try{ </p> <blockquote> <p> sink-&gt;locked_backend()-&gt;set_file_collector(sinks::file::make_collector(keywords::target = m_dirLocation, keywords::max_size = 1 * 1024));<em> m_maxLogFileSize)); </em>sink-&gt;locked_backend()-&gt;set_file_collector(sinks::file::make_collector(keywords::target = m_dirLocation, keywords::max_size = 10 * 1024 *1024, keywords::min_free_space = 1024)); </p> </blockquote> <p> } catch (exception e) { </p> <blockquote> <p> std::cout &lt;&lt; "Maximum size reached in collector" &lt;&lt; std::endl; </p> </blockquote> <p> } </p> <p> sink-&gt;set_formatter( </p> <blockquote> <p> expr::stream &lt;&lt; expr::format_date_time&lt; boost::posix_time::ptime &gt;("<a class="missing wiki">TimeStamp</a>", m_timeFormat) &lt;&lt; m_logSeparator &lt;&lt; "[" &lt;&lt; expr::attr&lt; boost::log::trivial::severity_level &gt;("Severity") &lt;&lt; "]" &lt;&lt; m_logSeparator &lt;&lt; " " &lt;&lt; expr::attr&lt; boost::thread::id &gt;("ThreadID") &lt;&lt; m_logSeparator &lt;&lt; " " &lt;&lt; expr::attr&lt;std::string&gt;("<a class="missing wiki">FileName</a>") &lt;&lt; "" &lt;&lt; ":" &lt;&lt; expr::attr&lt;int&gt;("Line") &lt;&lt; m_logSeparator &lt;&lt; " " &lt;&lt; expr::attr&lt;std::string&gt;("Function") &lt;&lt; m_logSeparator &lt;&lt; " " &lt;&lt; expr::xml_decor[expr::stream &lt;&lt; expr::smessage] </p> </blockquote> <blockquote> <p> ); </p> </blockquote> <p> sink-&gt;locked_backend()-&gt;scan_for_files(); sink-&gt;locked_backend()-&gt;auto_flush(true); </p> <p> <em> Add the sink to the core logging::core::get()-&gt;add_sink(sink); </em></p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12684 Trac 1.4.3 Kohei Takahashi Wed, 14 Dec 2016 00:57:11 GMT component changed; owner set https://svn.boost.org/trac10/ticket/12684#comment:1 https://svn.boost.org/trac10/ticket/12684#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Andrey Semashev</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">log</span> </li> </ul> Ticket Andrey Semashev Wed, 14 Dec 2016 06:30:13 GMT <link>https://svn.boost.org/trac10/ticket/12684#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12684#comment:2</guid> <description> <ol><li><code>max_size</code> limit does not cause logging to stop. Rather it forces deletion of the oldest file to free space for the new one, when the next file rotation happens. </li></ol><ol start="2"><li>Please, attach the complete compilable test case that reproduces the problem. Also please specify your compiler and platform. </li></ol> </description> <category>Ticket</category> </item> </channel> </rss>