Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11016: Boost file logging misbehaves when file system is full
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-02-23 04:44:10
#11016: Boost file logging misbehaves when file system is full
-------------------------------+----------------------
Reporter: michi@⦠| Owner: andysem
Type: Bugs | Status: reopened
Milestone: To Be Determined | Component: log
Version: Boost 1.55.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+----------------------
Comment (by anonymous):
Below is a stand-alone test case that shows the problem. This is with
boost 1.57 with your patch applied.
I create a 5 MB ram disk:
{{{
sudo mount -o size=5M -t tmpfs none /home/michi/tmp/ramdisk
}}}
Note that the code below hard-wires this path. Please adjust as necessary.
When I run the code in a loop, I see the empty log files appearing once
the file system fills up (one empty file per run).
{{{
while :; do ./a.out ; done
}}}
{{{
int main()
{
namespace keywords = boost::log::keywords;
namespace logging = boost::log;
namespace sinks = boost::log::sinks;
logging::sources::severity_channel_logger_mt<> logger;
typedef
logging::sinks::asynchronous_sink<logging::sinks::text_file_backend>
FileSinkT;
typedef boost::shared_ptr<FileSinkT> FileSinkPtr;
FileSinkPtr file_sink = boost::make_shared<FileSinkT>(
keywords::file_name =
"/home/michi/tmp/ramdisk/log-%N.log",
keywords::rotation_size
= 1024 * 512);
file_sink->locked_backend()->set_file_collector(sinks::file::make_collector(
keywords::target =
"/home/michi/tmp/ramdisk",
keywords::max_size
= 1024 * 1024 * 10));
file_sink->locked_backend()->scan_for_files();
file_sink->locked_backend()->auto_flush(true);
logging::core::get()->add_sink(file_sink);
for (int i = 0; i < 100000; ++i)
{
BOOST_LOG(logger) << "Hello";
}
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11016#comment:21> 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:17 UTC