From 608683745fdd1286488417011db57f25d541226d Mon Sep 17 00:00:00 2001 From: Jacob Evelyn Date: Mon, 2 Jun 2014 16:13:41 -0400 Subject: Use logger environment settings in Rails console. --- activerecord/CHANGELOG.md | 7 +++++++ activerecord/lib/active_record/railtie.rb | 3 +++ 2 files changed, 10 insertions(+) diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 9da1304953..c5df36c526 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,10 @@ +* Set Rails console to use log formatter and log level as specified for the + given environment. + + Fixes #15470. + + *Jacob Evelyn* + * New records remain new after YAML serialization. *Sean Griffin* diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index a4ceacbf44..bd09bbc705 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -60,6 +60,9 @@ module ActiveRecord require "active_record/railties/console_sandbox" if app.sandbox? require "active_record/base" console = ActiveSupport::Logger.new(STDERR) + console.formatter = Rails.logger.formatter + console.level = Rails.logger.level + Rails.logger.extend ActiveSupport::Logger.broadcast console end -- cgit v1.2.3