Log rotation. By default, we now use the standard Ruby Logger class to rotate the Instiki logfile.

This works fine with the default Webrick. But, if you're running under Mongrel (say), you probably
want to customize this in config/environments/production.rb .
master
Jacques Distler 2007-03-13 14:54:43 -05:00
parent c704f899af
commit f92ed693c0
2 changed files with 17 additions and 2 deletions

View File

@ -2,7 +2,7 @@ class Wiki
cattr_accessor :storage_path, :logger
self.storage_path = "#{RAILS_ROOT}/storage/"
self.logger = RAILS_DEFAULT_LOGGER
self.logger = INSTIKI_LOGGER
def authenticate(password)
password == (system.password || 'instiki')
@ -89,4 +89,4 @@ class Wiki
def write_page(web_address, page_name, content, written_on, author, renderer)
Web.find_by_address(web_address).add_page(page_name, content, written_on, author, renderer)
end
end
end

View File

@ -5,6 +5,21 @@ config.cache_classes = true
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
####
# This one rotates the log file, keeping 25 files, of 1MB each.
INSTIKI_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 25, 1024000)
# Unfortunately, the above does not work well under Mongrel, as the default Ruby logger class
# does no locking and you will have several processes running, each wanting to write to (and
# rotate) the log file. One solution is to have each mongrel instance writes to a different log file:
# http://blog.caboo.se/articles/2006/11/14/configure-mongrel-rails-logger-per-port for a solution.
# Another is to use the default logging behaviour:
#INSTIKI_LOGGER = RAILS_DEFAULT_LOGGER
# and use an external program (e.g. logrotate) to rotate the logs.
####
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false