[Boost-bugs] [Boost C++ Libraries] #12684: Application crashing when collector maximum size is reached

Subject: [Boost-bugs] [Boost C++ Libraries] #12684: Application crashing when collector maximum size is reached
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-12-13 10:26:10


#12684: Application crashing when collector maximum size is reached
-------------------------+------------------------------
 Reporter: ketan0712@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.61.0
 Severity: Problem | Keywords: BOOST
-------------------------+------------------------------
 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.

 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.

 Code is given below:
 sink = boost::make_shared<file_sink>(keywords::file_name = file_name,
     keywords::rotation_size = m_maxLogFileSize,
     keywords::open_mode = std::ios_base::out | std::ios_base::app,
     keywords::auto_flush = true
     );

 try{
 sink->locked_backend()->set_file_collector(sinks::file::make_collector(keywords::target
 = m_dirLocation, keywords::max_size = 1 * 1024));// m_maxLogFileSize));
 //sink->locked_backend()->set_file_collector(sinks::file::make_collector(keywords::target
 = m_dirLocation, keywords::max_size = 10 * 1024 *1024,
 keywords::min_free_space = 1024));
 }
 catch (exception e)
 {
     std::cout << "Maximum size reached in collector" << std::endl;
 }

 sink->set_formatter(
                         expr::stream
                         << expr::format_date_time<
 boost::posix_time::ptime >("TimeStamp", m_timeFormat) << m_logSeparator
                         << "[" << expr::attr<
 boost::log::trivial::severity_level >("Severity") << "]" << m_logSeparator
 << " "
                         << expr::attr< boost::thread::id >("ThreadID") <<
 m_logSeparator << " "
                         << expr::attr<std::string>("FileName") << ""
                         << ":" << expr::attr<int>("Line") <<
 m_logSeparator << " "
                         << expr::attr<std::string>("Function") <<
 m_logSeparator << " "
                         << expr::xml_decor[expr::stream << expr::smessage]
                     );

 sink->locked_backend()->scan_for_files();
 sink->locked_backend()->auto_flush(true);

 // Add the sink to the core
 logging::core::get()->add_sink(sink);

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12684>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC