aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-03-15 12:11:12 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-03-15 12:12:42 -0700
commite6c95fe3915bdc1eb1fffd5e508003f0d5f5ad78 (patch)
treeb5565613844206bd6c939ea2e4a87653a8854991 /activerecord/lib/active_record
parent94a20d94d53ad7a1eb64090d407c73e1f5c9de81 (diff)
downloadrails-e6c95fe3915bdc1eb1fffd5e508003f0d5f5ad78.tar.gz
rails-e6c95fe3915bdc1eb1fffd5e508003f0d5f5ad78.tar.bz2
rails-e6c95fe3915bdc1eb1fffd5e508003f0d5f5ad78.zip
errors should probably be logged as errors
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_adapter.rb39
1 files changed, 19 insertions, 20 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index 767c99de4c..1d713e472b 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -284,26 +284,25 @@ module ActiveRecord
protected
- def log(sql, name = "SQL", binds = [])
- @instrumenter.instrument(
- "sql.active_record",
- :sql => sql,
- :name => name,
- :connection_id => object_id,
- :binds => binds) { yield }
- rescue Exception => e
- message = "#{e.class.name}: #{e.message}: #{sql}"
- @logger.debug message if @logger
- exception = translate_exception(e, message)
- exception.set_backtrace e.backtrace
- raise exception
- end
-
- def translate_exception(e, message)
- # override in derived class
- ActiveRecord::StatementInvalid.new(message)
- end
-
+ def log(sql, name = "SQL", binds = [])
+ @instrumenter.instrument(
+ "sql.active_record",
+ :sql => sql,
+ :name => name,
+ :connection_id => object_id,
+ :binds => binds) { yield }
+ rescue Exception => e
+ message = "#{e.class.name}: #{e.message}: #{sql}"
+ @logger.error message if @logger
+ exception = translate_exception(e, message)
+ exception.set_backtrace e.backtrace
+ raise exception
+ end
+
+ def translate_exception(e, message)
+ # override in derived class
+ ActiveRecord::StatementInvalid.new(message)
+ end
end
end
end