Logger shift_log_period has problem shifting during daylight savings time
changeover
------------------------------------------------------------------------------------
Key: JRUBY-6191
URL: https://jira.codehaus.org/browse/JRUBY-6191
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.6.5, JRuby 1.5.2
Environment: Solaris 10.08
Sun Fire 480R: UltraSparc-III+
Reporter: Jason Herman
Systems were rebooted the same day as daylight savings time at approximately
12:01am.
We use a "daily" Logger. When the system started up on 07-November-2011, we
received the following error (and again when we restarted the applicaiton):
SEVERE: unable to create shared application instance
org.jruby.rack.RackInitializationException: Shifting failed.
'/foo/ApplicationX.log.20111106' already exists.
from file:/foo/META-INF/jruby.home/lib/ruby/1.8/monitor.rb in
`mon_synchronize'
from file:/foo/META-INF/jruby.home/lib/ruby/1.8/logger.rb in `write'
from file:/foo/META-INF/jruby.home/lib/ruby/1.8/logger.rb in `add'
from file:/foo/META-INF/jruby.home/lib/ruby/1.8/logger.rb in `error'
The error can be attributed to these lines of code.
def shift_log_period(now)
postfix = previous_period_end(now).strftime("%Y%m%d") # YYYYMMDD
age_file = "#{@filename}.#{postfix}"
if FileTest.exist?(age_file)
raise RuntimeError.new("'#{ age_file }' already exists.")
end
@dev.close
File.rename("#{@filename}", age_file)
@dev = create_logfile(@filename)
return true
end
Is there a way around this issue? Either File.rename("#{@filename}",
"#{age_file}_1") or can we append filename to the age_file
But to create a runtime error seems brutal.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email