Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 9013

Show
Ignore:
Timestamp:
03/13/08 01:54:34 (1 year ago)
Author:
david
Message:

Fixed that BufferedLogger should create its own directory if one doesnt already exist (closes #11285) [lotswholetime]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/CHANGELOG

    r9009 r9013  
    11*SVN* 
     2 
     3* Fixed that BufferedLogger should create its own directory if one doesn't already exist #11285 [lotswholetime] 
    24 
    35* Fix Numeric time tests broken by DST change by anchoring them to fixed times instead of Time.now. Anchor TimeZone#now DST test to time specified with Time.at instead of Time.local to work around platform differences with Time.local and DST representation [Geoff Buesing] 
  • trunk/activesupport/lib/active_support/buffered_logger.rb

    r8638 r9013  
    4848        @log.sync = true 
    4949      else 
     50        FileUtils.mkdir_p(File.dirname(log)) 
    5051        @log = open(log, (File::WRONLY | File::APPEND | File::CREAT)) 
    5152        @log.sync = true 
  • trunk/activesupport/test/buffered_logger_test.rb

    r8563 r9013  
    105105    assert !@output.string.empty?, @output.string 
    106106  end 
     107   
     108  def test_should_create_the_log_directory_if_it_doesnt_exist 
     109    tmp_directory = File.join(File.dirname(__FILE__), "tmp") 
     110    log_file = File.join(tmp_directory, "development.log") 
     111    assert !File.exist?(tmp_directory) 
     112    @logger  = ActiveSupport::BufferedLogger.new(log_file) 
     113    assert File.exist?(tmp_directory) 
     114  ensure 
     115    FileUtils.rm_rf(tmp_directory) 
     116  end 
    107117end