rails disable development.log but still log to STDOUT

ruby-on-rails

Solution

To suppress output to log files, set the output stream of the configured logger to `nil`.

# config/environments/development.rb
Rails.application.configure do
  config.logger = ActiveSupport::Logger.new(nil)
end

`rails server` will still log to `STDOUT`, but no log file is created.

Problem

how can I disable the logging to logs/(env).log but still preserve rails logging to STDOUT? The correct answer works in in a vanilla rails 4 app running the latest stable version of rails, with no modifications of the Gemfile (i.e. no additional dependencies) and does not use /dev/null (only modifications to ruby code). Monkey patching allowed (encouraged?). if it works in older versions of rails thats great but not required. Log output should not be altered in any way, e.g: ``` I, [2015-02-20T07:54:35.257440 #64936] INFO -- : Rendered /Users/lsu/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_source.erb (3.0ms) I, [2015-02-20T07:54:35.257504 #64936] INFO -- : Rendered /Users/lsu/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_source.erb (3.0ms) I, [2015-02-20T07:54:35.261314 #64936] INFO -- : Rendered /Users/lsu/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_trace.html.erb (1.3ms) I, [2015-02-20T07:54:35.261366 #64936] INFO -- : Rendered /Users/lsu/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_trace.html.erb (1.3ms) I, [2015-02-20T07:54:35.270427 #64936] INFO -- : Rendered /Users/lsu/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_request_and_response.html.erb (6.4ms) I, [2015-02-20T07:54:35.270466 #64936] INFO -- : Rendered /Users/lsu/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_request_and_response.html.erb (6.4ms) I, [2015-02-20T07:54:35.273338 #64936] INFO -- : Rendered /Users/lsu/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_web_console.html.erb (0.6ms) I, [2015-02-20T07:54:35.273367 #64936] INFO -- : Rendered /Users/lsu/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/_web_console.html.erb (0.6ms) I, [2015-02-20T07:54:35.273420 #64936] INFO -- : Rendered /Users/lsu/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/web-console-2.0.0/lib/action_dispatch/templates/rescues/diagnostics.html.erb within rescues/layout (22.8ms) ```

Original source