diff options
| author | Kasper Timm Hansen <kaspth@gmail.com> | 2018-07-08 20:01:45 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-08 20:01:45 +0200 | 
| commit | 50a9ca665d51cd3298af8b3c1dabf20ad5ce77da (patch) | |
| tree | c64dfa00bd0161eccb4a9a793f2baafe1aa3639f /railties/lib/rails/commands/server | |
| parent | 875a06b899909129422a0f307695c5b8e5409ea4 (diff) | |
| parent | 889a7ccf086c23baccb52342a631f1be81405e6b (diff) | |
| download | rails-50a9ca665d51cd3298af8b3c1dabf20ad5ce77da.tar.gz rails-50a9ca665d51cd3298af8b3c1dabf20ad5ce77da.tar.bz2 rails-50a9ca665d51cd3298af8b3c1dabf20ad5ce77da.zip | |
Merge pull request #28266 from Stellenticket/allow_disable_server_stdout_logging
rails server: Allow to explicitly specify whether to output Rails's log to stdout
Diffstat (limited to 'railties/lib/rails/commands/server')
| -rw-r--r-- | railties/lib/rails/commands/server/server_command.rb | 11 | 
1 files changed, 9 insertions, 2 deletions
| diff --git a/railties/lib/rails/commands/server/server_command.rb b/railties/lib/rails/commands/server/server_command.rb index 9a5d29f77d..2c5440d9ec 100644 --- a/railties/lib/rails/commands/server/server_command.rb +++ b/railties/lib/rails/commands/server/server_command.rb @@ -132,13 +132,14 @@ module Rails          desc: "Specifies whether to perform caching in development."        class_option :restart, type: :boolean, default: nil, hide: true        class_option :early_hints, type: :boolean, default: nil, desc: "Enables HTTP/2 early hints." +      class_option :log_to_stdout, type: :boolean, default: nil, optional: true, +        desc: "Whether to log to stdout. Enabled by default in development when not daemonized."        def initialize(args, local_options, *)          super          @original_options = local_options - %w( --restart )          deprecate_positional_rack_server_and_rewrite_to_option(@original_options) -        @log_stdout = options[:daemon].blank? && (options[:environment] || Rails.env) == "development"        end        def perform @@ -166,7 +167,7 @@ module Rails            {              user_supplied_options: user_supplied_options,              server:                using, -            log_stdout:            @log_stdout, +            log_stdout:            log_to_stdout?,              Port:                  port,              Host:                  host,              DoNotReverseLookup:    true, @@ -256,6 +257,12 @@ module Rails            options[:early_hints]          end +        def log_to_stdout? +          options.fetch(:log_to_stdout) do +            options[:daemon].blank? && environment == "development" +          end +        end +          def pid            File.expand_path(options[:pid])          end | 
