Permalink
Browse files

Merge pull request #4998 from fbuenemann/feature/configurable-log-flu…

…shing

Make automatic log flushing configurable
  • Loading branch information...
2 parents 5497432 + 4a98a30 commit abf3f67e27b81cb1af54f3fca8bf8ddf1363e6ca @tenderlove tenderlove committed Feb 22, 2012
@@ -30,7 +30,7 @@ module Bootstrap
f = File.open path, 'a'
f.binmode
- f.sync = true # make sure every write flushes
+ f.sync = config.autoflush_log # if true make sure every write flushes
logger = ActiveSupport::TaggedLogging.new(
ActiveSupport::Logger.new(f)
@@ -5,7 +5,7 @@
module Rails
class Application
class Configuration < ::Rails::Engine::Configuration
- attr_accessor :allow_concurrency, :asset_host, :asset_path, :assets,
+ attr_accessor :allow_concurrency, :asset_host, :asset_path, :assets, :autoflush_log,
:cache_classes, :cache_store, :consider_all_requests_local, :console,
:dependency_loading, :exceptions_app, :file_watcher, :filter_parameters,
:force_ssl, :helpers_paths, :logger, :log_tags, :preload_frameworks,
@@ -41,6 +41,7 @@ def initialize(*)
@file_watcher = ActiveSupport::FileUpdateChecker
@exceptions_app = nil
@default_method_for_update = :put
+ @autoflush_log = true
@assets = ActiveSupport::OrderedOptions.new
@assets.enabled = false
@@ -35,4 +35,7 @@
# Expands the lines which load the assets.
config.assets.debug = true
<%- end -%>
+
+ # Disable automatic flushing of the log to improve performance.
+ #config.autoflush_log = false
end

1 comment on commit abf3f67

Thanks for this patch Aaron, sounds like this should fix the woes of development mode when a process that isn't Rails has written to the log file, and the next HTTP request has to suffer 200,000,000 million lines of output (and being dog slow) as punishment for being bold enough to look to other tools for long running jobs!

Ahoy!

Please sign in to comment.