summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/configuration.rb5
-rw-r--r--lib/puppet/rails.rb9
2 files changed, 12 insertions, 2 deletions
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":