diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-07-09 23:15:01 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-07-09 23:15:01 +0000 |
commit | eabe0d1c31052c1fa3cb67cd8950d964cb137a19 (patch) | |
tree | 45208aae9fa55263be4caae90388522fa222ba17 /lib/puppet | |
parent | d36d0cf16939851f62bd45d3a79e87f483470eb2 (diff) | |
download | puppet-eabe0d1c31052c1fa3cb67cd8950d964cb137a19.tar.gz puppet-eabe0d1c31052c1fa3cb67cd8950d964cb137a19.tar.xz puppet-eabe0d1c31052c1fa3cb67cd8950d964cb137a19.zip |
Fixing #710 -- you can now specify the rails_loglevel
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2667 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/configuration.rb | 5 | ||||
-rw-r--r-- | lib/puppet/rails.rb | 9 |
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": |