[ruby-cvs:63539] nobu:r56374 (trunk): logger: fix monthly log rotate with DST

nobu at ruby-lang.org nobu at ruby-lang.org
Sat Oct 8 09:06:57 JST 2016


nobu	2016-10-08 09:06:57 +0900 (Sat, 08 Oct 2016)

  New Revision: 56374

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56374

  Log:
    logger: fix monthly log rotate with DST
    
    * lib/logger.rb (Logger::Period#next_rotate_time): fix monthly log
      rotate when DST is applied during a month of 31 days.
      [Fix GH-1458]
    
    With DST the month of october can actually last more than 31 days.
    It can last 31 days plus 1 hour. So during october, `t` used to be
    equal to "2016-10-31 23:00:00" instead of "2016-11-01 00:00:00".
    This was then normalized to "2016-10-01 00:00:00" which lead every
    single line of log during october to rotate the log file.
    This fix ensure that next_rotate_time(now, 'monthly') always return
    the first day of next month in every situation.

  Modified files:
    trunk/ChangeLog
    trunk/lib/logger.rb
    trunk/test/logger/test_logdevice.rb


More information about the ruby-cvs mailing list