Skip to content
This repository
Browse code

Make log autoflushing configurable

  • Loading branch information...
commit 0f3d426a16037d968f12a73b86c798def0588073 1 parent 5497432
Felix Bünemann authored February 10, 2012
2  railties/lib/rails/application/bootstrap.rb
@@ -30,7 +30,7 @@ module Bootstrap
30 30
 
31 31
           f = File.open path, 'a'
32 32
           f.binmode
33  
-          f.sync = true # make sure every write flushes
  33
+          f.sync = config.autoflush_log # if true make sure every write flushes
34 34
 
35 35
           logger = ActiveSupport::TaggedLogging.new(
36 36
             ActiveSupport::Logger.new(f)
3  railties/lib/rails/application/configuration.rb
@@ -5,7 +5,7 @@
5 5
 module Rails
6 6
   class Application
7 7
     class Configuration < ::Rails::Engine::Configuration
8  
-      attr_accessor :allow_concurrency, :asset_host, :asset_path, :assets,
  8
+      attr_accessor :allow_concurrency, :asset_host, :asset_path, :assets, :autoflush_log,
9 9
                     :cache_classes, :cache_store, :consider_all_requests_local, :console,
10 10
                     :dependency_loading, :exceptions_app, :file_watcher, :filter_parameters,
11 11
                     :force_ssl, :helpers_paths, :logger, :log_tags, :preload_frameworks,
@@ -41,6 +41,7 @@ def initialize(*)
41 41
         @file_watcher                  = ActiveSupport::FileUpdateChecker
42 42
         @exceptions_app                = nil
43 43
         @default_method_for_update     = :put
  44
+        @autoflush_log                 = !Rails.env.production?
44 45
 
45 46
         @assets = ActiveSupport::OrderedOptions.new
46 47
         @assets.enabled                  = false

0 notes on commit 0f3d426

Please sign in to comment.
Something went wrong with that request. Please try again.