Boost C++ Libraries: Ticket #8864: Problem with log file rotation https://svn.boost.org/trac10/ticket/8864 <p> There seems to be a problem with log file rotation because I occasionally encountering the following exception when logging to rotated files: </p> <blockquote> <p> std::runtime_error: boost::filesystem::last_write_time: No such file or directory: "/home/Devel/projects/id3v23/test/log/20130720_110200.log </p> </blockquote> <p> I'm using the following settings for log file rotation: </p> <blockquote> <p> rotation size = 1024 target = logs max size = 10240 </p> </blockquote> <p> My test environment is Fedora 18 32/64 bits. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8864 Trac 1.4.3 lcarreon@… Sat, 20 Jul 2013 01:30:35 GMT <link>https://svn.boost.org/trac10/ticket/8864#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8864#comment:1</guid> <description> <p> Sorry, forgot to mention that the filename template is: </p> <blockquote> <p> log/%Y%m%d_%H%M%S.log </p> </blockquote> </description> <category>Ticket</category> </item> <item> <author>lcarreon@…</author> <pubDate>Mon, 22 Jul 2013 01:09:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8864#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8864#comment:2</guid> <description> <p> Here is a list of the created log files based on a single run of my test program using the above-mentioned configuration. </p> <p> -rw-rw----. 1 dev11 dev 973 Jul 22 10:21 20130722_102108.log </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00000 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00001 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00002 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00003 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00004 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00005 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00006 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00007 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00008 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00009 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00010 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00011 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00012 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00013 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00014 </p> <p> -rw-rw----. 1 dev11 dev 139 Jul 22 10:21 20130722_102108.log00015 </p> <p> Each log record contains the following 139-byte message where only the timestamp is changing: </p> <p> 2013-07-22 10:36:05.118868 [warning] test_library:000000x9f3:0x00007f7d21cf5740 (src/ctag.cpp, 823) Unknown frame 'UNKN' has been detected </p> <p> The size of the first log file is correct based on the rotation size of 1024 bytes. I also noticed that due to the speed of the logging, the same log file name is used. The other issue is that the succeeding log files are smaller than expected. Finally, I'm expecting only 8 log records but I'm seeing 22 log records spread in 16 log files. </p> <p> I tried changing the filename template to "log/log.log" but is still giving me the same result where only the log file names changed. </p> </description> <category>Ticket</category> </item> <item> <author>lcarreon@…</author> <pubDate>Mon, 22 Jul 2013 08:17:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8864#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8864#comment:3</guid> <description> <p> I have decided to experiment and tried removing the settings to do with rotated log file collection (i.e. removed target, maximum size and scan method). </p> <p> The result is log files being rotated correctly with the correct number of log records in each of them based on the logging that my test program has performed. </p> <p> This seems to indicate that managing the collection of log files is faulty although I have observed that the original location of the log files must be different to the location where they collected. If the original location and the collection location are identical, a different kind of problem occurs. </p> <p> Unfortunately, I could not assist in locating the problem because the source code of the logging library is too complex for me because I have not studied how Boost.Parameter and Boost.Phoenix works making it difficult to comprehend the code. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 04 Aug 2013 07:56:08 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/8864#comment:4 https://svn.boost.org/trac10/ticket/8864#comment:4 <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 Sun, 04 Aug 2013 10:25:54 GMT <link>https://svn.boost.org/trac10/ticket/8864#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8864#comment:5</guid> <description> <p> Could you provide a minimal compilable test case that reproduces the problem? </p> </description> <category>Ticket</category> </item> <item> <author>lcarreon@…</author> <pubDate>Mon, 05 Aug 2013 00:56:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8864#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8864#comment:6</guid> <description> <p> I was trying to produce the minimal compilable test case that produces the problem when I have discovered what was wrong. I was initializing Boost.Log in a test suite fixture instead of a global fixture. This was what was causing the incorrect behaviour. </p> <p> Sorry for the trouble that I have caused. You may close this bug because it was my mistake. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Mon, 05 Aug 2013 03:22:05 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8864#comment:7 https://svn.boost.org/trac10/ticket/8864#comment:7 <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> Ticket