Ticket #11285: auto_create_log_directory.diff
| File auto_create_log_directory.diff, 1.8 kB (added by lotswholetime, 7 months ago) |
|---|
-
activesupport/test/buffered_logger_test.rb
old new 104 104 @logger.info 'there it is.' 105 105 assert !@output.string.empty?, @output.string 106 106 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 107 117 end -
activesupport/lib/active_support/buffered_logger.rb
old new 47 47 @log = open(log, (File::WRONLY | File::APPEND)) 48 48 @log.sync = true 49 49 else 50 FileUtils.mkdir_p(File.dirname(log)) 50 51 @log = open(log, (File::WRONLY | File::APPEND | File::CREAT)) 51 52 @log.sync = true 52 53 @log.write("# Logfile created on %s" % [Time.now.to_s]) -
railties/lib/initializer.rb
old new 255 255 logger.auto_flushing = false 256 256 logger.set_non_blocking_io 257 257 end 258 rescue StandardError => e258 rescue StandardError => e 259 259 logger = ActiveSupport::BufferedLogger.new(STDERR) 260 260 logger.level = ActiveSupport::BufferedLogger::WARN 261 261 logger.warn(