aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2013-09-22 20:02:32 -0700
committerGuillermo Iguaran <guilleiguaran@gmail.com>2013-09-22 20:02:32 -0700
commitc21941b1c71b9254103929117670e7cbb53aa243 (patch)
tree5d7d9e8319db97feb754ef1859bc3ca1ea998c1a /railties
parent7dcde9fba4928eb68a5f6be7173af29ba775401c (diff)
parent5f98bb402b657f785e6bf1a49e83d44c6d3aa062 (diff)
downloadrails-c21941b1c71b9254103929117670e7cbb53aa243.tar.gz
rails-c21941b1c71b9254103929117670e7cbb53aa243.tar.bz2
rails-c21941b1c71b9254103929117670e7cbb53aa243.zip
Merge pull request #11060 from schneems/schneems/multi-stdout-logging-master
Only output Server logs in Development
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md5
-rw-r--r--railties/lib/rails/commands/server.rb5
-rw-r--r--railties/test/commands/server_test.rb10
3 files changed, 18 insertions, 2 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index 797cffc884..fabc981e7a 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,3 +1,8 @@
+* `rails server` will only extend the logger to output to STDOUT
+ in development environment.
+
+ *Richard Schneeman*
+
* Don't require passing path to app before options in `rails new`
and `rails plugin new`
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index 87d6505ed5..485bd1eb09 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -32,7 +32,8 @@ module Rails
opt_parser.parse! args
- options[:server] = args.shift
+ options[:log_stdout] = options[:daemonize].blank? && options[:environment] == "development"
+ options[:server] = args.shift
options
end
end
@@ -74,7 +75,7 @@ module Rails
FileUtils.mkdir_p(File.join(Rails.root, 'tmp', dir_to_make))
end
- unless options[:daemonize]
+ if options[:log_stdout]
wrapped_app # touch the app so the logger is set up
console = ActiveSupport::Logger.new($stdout)
diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb
index cb57b3c0cd..20afca2618 100644
--- a/railties/test/commands/server_test.rb
+++ b/railties/test/commands/server_test.rb
@@ -39,4 +39,14 @@ class Rails::ServerTest < ActiveSupport::TestCase
assert_equal 'production', server.options[:environment]
end
end
+
+ def test_log_stdout
+ args = ["-e", "development"]
+ options = Rails::Server::Options.new.parse!(args)
+ assert_equal true, options[:log_stdout]
+
+ args = ["-e", "production"]
+ options = Rails::Server::Options.new.parse!(args)
+ assert_equal false, options[:log_stdout]
+ end
end