aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands/server.rb
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-01-17 12:46:51 +1100
committerMikel Lindsaar <raasdnil@gmail.com>2010-01-17 12:46:51 +1100
commit6f663addaa7ed40f1133687d7a2be0958bf0c059 (patch)
tree7beb7f092c1979d1fd5ea6e7aaaf4f59c2f4abf4 /railties/lib/rails/commands/server.rb
parent8834b2612b7ddda70ee6a685eb0063d3daa8e63d (diff)
parent3e94032227d450d479f511070c51f37f53d0ecc4 (diff)
downloadrails-6f663addaa7ed40f1133687d7a2be0958bf0c059.tar.gz
rails-6f663addaa7ed40f1133687d7a2be0958bf0c059.tar.bz2
rails-6f663addaa7ed40f1133687d7a2be0958bf0c059.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'railties/lib/rails/commands/server.rb')
-rw-r--r--railties/lib/rails/commands/server.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index 09d7207d51..115499db05 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -38,15 +38,15 @@ module Rails
end
def start
+ ENV["RAILS_ENV"] = options[:environment]
+
puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}"
- puts "=> Rails #{Rails.version} application starting on http://#{options[:Host]}:#{options[:Port]}"
+ puts "=> Rails #{Rails.version} application starting in #{Rails.env} on http://#{options[:Host]}:#{options[:Port]}"
puts "=> Call with -d to detach" unless options[:daemonize]
trap(:INT) { exit }
puts "=> Ctrl-C to shutdown server" unless options[:daemonize]
- ENV["RAILS_ENV"] = options[:environment]
- RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV)
-
+ initialize_log_tailer! unless options[:daemonize]
super
ensure
puts 'Exiting' unless options[:daemonize]
@@ -54,7 +54,6 @@ module Rails
def middleware
middlewares = []
- middlewares << [Rails::Rack::LogTailer, log_path] unless options[:daemonize]
middlewares << [Rails::Rack::Debugger] if options[:debugger]
Hash.new(middlewares)
end
@@ -72,5 +71,14 @@ module Rails
:pid => "tmp/pids/server.pid"
})
end
+
+ protected
+
+ # LogTailer should not be used as a middleware since the logging happens
+ # async in a request and the middleware calls are sync. So we send it
+ # to subscriber which will be responsible for calling tail! in the log tailer.
+ def initialize_log_tailer!
+ Rails::Subscriber.log_tailer = Rails::Rack::LogTailer.new(nil, log_path)
+ end
end
end