aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
diff options
context:
space:
mode:
authorMarkus Doits <markus.doits@stellenticket.de>2018-07-08 17:28:34 +0200
committerMarkus Doits <markus.doits@stellenticket.de>2018-07-08 17:28:34 +0200
commit889a7ccf086c23baccb52342a631f1be81405e6b (patch)
tree784cd715b6bf4fefc08b92b8e191b83b153e546c /railties/test/commands
parent79edcaeb6ccd7f95029e36dd1a13369b119edfdf (diff)
downloadrails-889a7ccf086c23baccb52342a631f1be81405e6b.tar.gz
rails-889a7ccf086c23baccb52342a631f1be81405e6b.tar.bz2
rails-889a7ccf086c23baccb52342a631f1be81405e6b.zip
Allow to explicitly specify whether to output Rails' log to stdout
Before Rails' logger output is mirrored to std out if: * environment is development and * the process is not daemonized It was not possible to change that behaviour, e.g. to disable log output in that case or enable it in other cases. Now you can explicitly disable or enable output with the new command line switch `--log-to-stdout`, regardless of any other circumstances. ``` // enable output in production rails server -e production --log-to-stdout // disable output in development rails server -e development --no-log-to-stdout ``` Enabling output when daemonized still makes no sense (since tty is detached), but this is ignored for now. If the command line flag is not specified, old behaviour still applies, so this change is completely backward compatible.
Diffstat (limited to 'railties/test/commands')
-rw-r--r--railties/test/commands/server_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb
index a20fece960..e5b1da6ea4 100644
--- a/railties/test/commands/server_test.rb
+++ b/railties/test/commands/server_test.rb
@@ -143,10 +143,22 @@ class Rails::Command::ServerCommandTest < ActiveSupport::TestCase
options = parse_arguments(args)
assert_equal true, options[:log_stdout]
+ args = ["-e", "development", "-d"]
+ options = parse_arguments(args)
+ assert_equal false, options[:log_stdout]
+
args = ["-e", "production"]
options = parse_arguments(args)
assert_equal false, options[:log_stdout]
+ args = ["-e", "development", "--no-log-to-stdout"]
+ options = parse_arguments(args)
+ assert_equal false, options[:log_stdout]
+
+ args = ["-e", "production", "--log-to-stdout"]
+ options = parse_arguments(args)
+ assert_equal true, options[:log_stdout]
+
with_rack_env "development" do
args = []
options = parse_arguments(args)