Just a quick note, it seems that trac, dev.rubyonrails.org is down... So i''m sending this as an email instead of a ticket. I''m not sure if this is a good idea, but i was playing around with the logger stuff and i noticed that Logger has build in the ability to rotate logs ever x time or when the files get to x size. With odeo we had some log files which got to be big, about 7 gigs or so a week, per server. So having built in rotation would seem useful. Looking around it seemed like this could be something nice to add to the configuration files. Rotate logs weekly. I''m not convinced that my patch is the right way to do it, nor that adding these kind of configuration options is right. After all people can track this down themselves and manually load the logger object. Log rotation seems like something people should do, and it''s already in the library we use by default. I was surprised to see that railities has so few tests. To write an effective test for this, i''d need to mock the file objects. What do people think of including mockfs or some other mock libraries in ralities? Is it intentional that railities is so weak on tests? Should i make sure to include a test for patches to railities, that way we can at least incrementally improve things. Anyway, here''s my patch.... (i''ll post it as a ticket when i can) -rabble Index: railties/lib/initializer.rb ==================================================================--- railties/lib/initializer.rb (revision 4610) +++ railties/lib/initializer.rb (working copy) @@ -193,10 +193,10 @@ def initialize_logger # if the environment has explicitly defined a logger, use it return if defined?(RAILS_DEFAULT_LOGGER) - + unless logger = configuration.logger begin - logger = Logger.new(configuration.log_path) + logger = Logger.new(configuration.log_path, configuration.log_rotation_frequency, configuration.log_rotation_size) logger.level = Logger.const_get(configuration.log_level.to_s.upcase) rescue StandardError logger = Logger.new(STDERR) @@ -421,6 +421,16 @@ # used directly. attr_accessor :logger + # The frequency for which logs should be rotate when using the default + # logger. Valid formats are the number of old log files to keep, *or* + # frequency of rotation (+daily+, +weekly+ or +monthly+). + # Defaults to <tt>0</tt>, for no rotation. + attr_accessor :log_rotation_frequency + + # The max size of a log file before rotation. Only used if the logs + # have a set rotation frequency. Defaults to nil. + attr_accessor :log_rotation_size + # The root of the application''s views. (Defaults to <tt>app/views</tt>.) attr_accessor :view_path @@ -439,6 +449,8 @@ self.load_paths = default_load_paths self.log_path = default_log_path self.log_level = default_log_level + self.log_rotation_frequency = default_log_rotation_frequency + self.log_rotation_size = default_log_rotation_size self.view_path = default_view_path self.controller_paths = default_controller_paths self.cache_classes = default_cache_classes @@ -541,6 +553,14 @@ environment == ''production'' ? :info : :debug end + def default_log_rotation_frequency + return 0 + end + + def default_log_rotation_size + return nil + end + def default_database_configuration_file File.join(root_path, ''config'', ''database.yml'') end