By using our own logger to do log rotation, we ran into 2 problems. First, having rails rotate it's own files causes problems when multiple rails workers try to rotate the logs at the same time, as can occur when using delayed_job or passenger.
Second, the logger we created used :default as the log level, which made for incredibly verbose, large log files in production. Production normally defaults to :info, which doesn't include every SQL query in the logs. By just using the default logger we get the verbosity we want, and don't have log rotation issues. This commit includes a brief mention in the README that the user should setup log rotation, and ticket #8264 was created to setup log rotation in the packaged version of Dashboard. Reviewed-by: Daniel Pittman <dan...@puppetlabs.com> Signed-off-by: Matt Robinson <m...@puppetlabs.com> --- Local-branch: ticket/master/8251-logger_verbosity README.markdown | 5 +++-- config/environment.rb | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index a93ded8..ed793be 100644 --- a/README.markdown +++ b/README.markdown @@ -371,9 +371,10 @@ Debugging The Puppet Dashboard may not start or may display warnings if misconfigured or if it encounters an error. Details about these errors are recorded to log files that will help diagnose and resolve the problem. -You can find the logs in the `log` subdirectory of the Puppet Dashboard install, which will probably be in `/usr/share/puppet-dashboard/log/{environment}.log` if you installed from a package. You may want to customize your log rotation in `config/environment.rb`, if you would like to devote more or less disk to archival of logs. +You can find the logs in the `log` subdirectory of the Puppet Dashboard install, which will probably be in `/usr/share/puppet-dashboard/log/{environment}.log` if you installed from a package. If you installed from source, it will be wherever you cloned your git repository. + +You should manage your log files using logrotate or something similar in order to avoid them getting too large. Part of your logrotate job should restart any web servers or delayed_job workers. -If you installed from source, it will be wherever you cloned your git repository. If you're running Puppet Dashboard using Apache and Phusion Passenger, the Apache logs will contain higher-level information, like severe errors describing why the Passenger application couldn't start if it couldn't write to its logs. diff --git a/config/environment.rb b/config/environment.rb index 73d54b8..b72ca02 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -19,9 +19,6 @@ Rails::Initializer.run do |config| config.gem 'maruku' config.gem 'daemons', :version => '1.0.10' - # Change this to adjust log rotation. Logger.new(log_file, number_of_logs, max_log_size). - config.logger = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 50, 10.megabytes) - # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. -- 1.7.3.1 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.