diff options
| -rw-r--r-- | CHANGELOG | 5 | ||||
| -rw-r--r-- | lib/puppet/configuration.rb | 5 | ||||
| -rw-r--r-- | lib/puppet/rails.rb | 9 |
3 files changed, 17 insertions, 2 deletions
@@ -1,3 +1,8 @@ + The Rails log level can now be set via (shockingly!) the + 'rails_loglevel' parameter (#710). Note that this isn't + exactly the feature asked for, but I could not find a + way to directly copy ActiveRecord's concept of an environment. + External node sources can now return undefined classes (#687). Puppet clients now have http proxy support (#701). diff --git a/lib/puppet/configuration.rb b/lib/puppet/configuration.rb index d44035dda..1589fc01b 100644 --- a/lib/puppet/configuration.rb +++ b/lib/puppet/configuration.rb @@ -511,7 +511,10 @@ module Puppet :owner => "$user", :group => "$group", :desc => "Where Rails-specific logs are sent" - } + }, + :rails_loglevel => ["info", "The log level for Rails connections. The value must be + a valid log level within Rails. Production environments normally use ``info`` + and other environments normally use ``debug``."] ) setdefaults(:graphing, diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb index b68e7d352..670c622eb 100644 --- a/lib/puppet/rails.rb +++ b/lib/puppet/rails.rb @@ -12,6 +12,13 @@ module Puppet::Rails Puppet.config.use(:main, :rails, :puppetmasterd) ActiveRecord::Base.logger = Logger.new(Puppet[:railslog]) + begin + loglevel = Logger.const_get(Puppet[:rails_loglevel].upcase) + ActiveRecord::Base.logger.level = loglevel + rescue => detail + Puppet.warning "'%s' is not a valid Rails log level; using debug" % Puppet[:rails_loglevel] + ActiveRecord::Base.logger.level = Logger::DEBUG + end ActiveRecord::Base.allow_concurrency = true ActiveRecord::Base.verify_active_connections! @@ -28,7 +35,7 @@ module Puppet::Rails # The arguments for initializing the database connection. def self.database_arguments - args = {:adapter => Puppet[:dbadapter]} + args = {:adapter => Puppet[:dbadapter], :log_level => Puppet[:rails_loglevel]} case Puppet[:dbadapter] when "sqlite3": |
