aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-06-16 23:44:20 +0900
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-06-18 13:05:17 -0300
commit052e415f22b98bb45a5245ac8f7aa23c6f32e478 (patch)
tree082e9ae5e2ce90b865bfc14b6abb918c5b94a605
parent8c02918497dca0415de0d7a605b9015b67c623ab (diff)
downloadrails-052e415f22b98bb45a5245ac8f7aa23c6f32e478.tar.gz
rails-052e415f22b98bb45a5245ac8f7aa23c6f32e478.tar.bz2
rails-052e415f22b98bb45a5245ac8f7aa23c6f32e478.zip
Change minimum (default) log level in PostgreSQL to warning.
-rw-r--r--activerecord/CHANGELOG.md6
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb2
-rw-r--r--activerecord/test/cases/adapters/postgresql/connection_test.rb4
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml4
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml4
5 files changed, 15 insertions, 5 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index cfb1e7071c..727dfbd30b 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,5 +1,11 @@
## Rails 4.0.0 (unreleased) ##
+* PostgreSQL default log level is now 'warning', to bypass the noisy notice
+ messages. You can change the log level using the `min_messages` option
+ available in your config/database.yml.
+
+ *kennyj*
+
* Add uuid datatype support to PostgreSQL adapter. *Konstantin Shabanov*
* `update_attribute` has been removed. Use `update_column` if
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index b08c59d97d..43e243581c 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -1450,7 +1450,7 @@ module ActiveRecord
if @config[:encoding]
@connection.set_client_encoding(@config[:encoding])
end
- self.client_min_messages = @config[:min_messages] if @config[:min_messages]
+ self.client_min_messages = @config[:min_messages] || 'warning'
self.schema_search_path = @config[:schema_search_path] || @config[:schema_order]
# Use standard-conforming strings if available so we don't have to do the E'...' dance.
diff --git a/activerecord/test/cases/adapters/postgresql/connection_test.rb b/activerecord/test/cases/adapters/postgresql/connection_test.rb
index adb2cef010..f6e168caf2 100644
--- a/activerecord/test/cases/adapters/postgresql/connection_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/connection_test.rb
@@ -21,6 +21,10 @@ module ActiveRecord
assert_not_nil @connection.encoding
end
+ def test_default_client_min_messages
+ assert_equal "warning", @connection.client_min_messages
+ end
+
# Ensure, we can set connection params using the example of Generic
# Query Optimizer (geqo). It is 'on' per default.
def test_connection_options
diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml
index fe9466b366..e1a00d076f 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml
+++ b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml
@@ -22,8 +22,8 @@ development:
# Minimum log levels, in increasing order:
# debug5, debug4, debug3, debug2, debug1,
# log, notice, warning, error, fatal, and panic
- # The server defaults to notice.
- #min_messages: warning
+ # Defaults to warning.
+ #min_messages: notice
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml
index 467a4e725f..07223a71c9 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml
+++ b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml
@@ -35,8 +35,8 @@ development:
# Minimum log levels, in increasing order:
# debug5, debug4, debug3, debug2, debug1,
# log, notice, warning, error, fatal, and panic
- # The server defaults to notice.
- #min_messages: warning
+ # Defaults to warning.
+ #min_messages: notice
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".