Project

General

Profile

Bug #11620

Logger throws "ArgumentError: argument out of range" with weekly rotation when switch to standard time (DST) and last day of the week is 1st of next month

Added by emrox (Stefan Bauckmeier) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-core:71185]

Description

We discovered a bug within the Ruby Logger. Having 'weekly' as Argument for shift_age in this year (2015) when returned from summer time to standard time (DST).
Creating a new Logger results in throwing a "ArgumentError: argument out of range" Exception.
The bug affects this year because the last day of week (Sunday) is not within this month (it's the 1st of November)

require 'timecop'

Timecop.freeze(2015,10,24,13,37)
Logger.new('test','weekly')
# => #<Logger:0x007fe269c3a048 ...

Timecop.freeze(2015,10,25,13,37)
Logger.new('test','weekly')
# ArgumentError: argument out of range
#   from /Users/stefan/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/logger.rb:547:in `mktime'
#   from /Users/stefan/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/logger.rb:547:in `next_rotate_time'
#   from /Users/stefan/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/logger.rb:589:in `initialize'
#   from /Users/stefan/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/logger.rb:318:in `new'
#   from /Users/stefan/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/logger.rb:318:in `initialize'
#   from (irb):7:in `new'
#   from (irb):7
#      ...

Timecop.freeze(2015,10,26,13,37)
Logger.new('test','weekly')
# => #<Logger:0x007fe27046e470 ...

Associated revisions

Revision e8c00b70
Added by nobu (Nobuyoshi Nakada) over 3 years ago

logger.rb: fix weekly rotation

  • lib/logger.rb (Logger::Period#next_rotate_time): get rid of adding to mday not to exceed the days of the month. [ruby-core:71185] [Bug #11620]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 52293
Added by nobu (Nobuyoshi Nakada) over 3 years ago

logger.rb: fix weekly rotation

  • lib/logger.rb (Logger::Period#next_rotate_time): get rid of adding to mday not to exceed the days of the month. [ruby-core:71185] [Bug #11620]

Revision 52293
Added by nobu (Nobuyoshi Nakada) over 3 years ago

logger.rb: fix weekly rotation

  • lib/logger.rb (Logger::Period#next_rotate_time): get rid of adding to mday not to exceed the days of the month. [ruby-core:71185] [Bug #11620]

Revision 52293
Added by nobu (Nobuyoshi Nakada) over 3 years ago

logger.rb: fix weekly rotation

  • lib/logger.rb (Logger::Period#next_rotate_time): get rid of adding to mday not to exceed the days of the month. [ruby-core:71185] [Bug #11620]

Revision 52293
Added by nobu (Nobuyoshi Nakada) over 3 years ago

logger.rb: fix weekly rotation

  • lib/logger.rb (Logger::Period#next_rotate_time): get rid of adding to mday not to exceed the days of the month. [ruby-core:71185] [Bug #11620]

Revision 52293
Added by nobu (Nobuyoshi Nakada) over 3 years ago

logger.rb: fix weekly rotation

  • lib/logger.rb (Logger::Period#next_rotate_time): get rid of adding to mday not to exceed the days of the month. [ruby-core:71185] [Bug #11620]

History

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Status changed from Open to Feedback

What timezone are you using?

Updated by emrox (Stefan Bauckmeier) over 3 years ago

Local timezone is CET (Europe/Germany/Berlin)

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Tracker changed from Feature to Bug
  • Project changed from CommonRuby to Ruby trunk
#4

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Status changed from Feedback to Closed

Applied in changeset r52293.


logger.rb: fix weekly rotation

  • lib/logger.rb (Logger::Period#next_rotate_time): get rid of adding to mday not to exceed the days of the month. [ruby-core:71185] [Bug #11620]

Also available in: Atom PDF