提交 c21941b1 编写于 作者: G Guillermo Iguaran

Merge pull request #11060 from schneems/schneems/multi-stdout-logging-master

Only output Server logs in Development
* `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`
......
......@@ -32,7 +32,8 @@ def parse!(args)
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 @@ def start
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)
......
......@@ -39,4 +39,14 @@ def test_environment_with_rack_env
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册