-
-
Save ahoward/724825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.join(File.dirname(__FILE__), 'boot') | |
Rails::Initializer.run do |config| | |
config.gem 'logging', :lib => false | |
config.gem 'lockfile', :lib => false | |
# local libs/gems that can/must be loaded *inside* rails initializer | |
# | |
require 'logging' unless defined?(Logging) | |
require 'lockfile' unless defined?(Lockfile) | |
# force gem loading now | |
# | |
Rails::Initializer.run(:add_gem_load_paths, config) | |
Rails::Initializer.run(:load_gems, config) | |
# do the actual logging configuration - this one will keep 7 log files of | |
# roughly 42 mega-bytes on disk and fill not your lovely drive | |
# | |
require 'fileutils' | |
FileUtils.mkdir_p File.join(RAILS_ROOT, 'log') | |
logpath = config.log_path | |
number_rolled = 7 | |
megabytes = 2 ** 20 | |
max_size = 42 * megabytes | |
options = { :safe => true } # for multi-process safe rolling | |
logger = ::Logging.logger( | |
logpath, | |
number_rolled, | |
max_size, | |
options | |
) | |
config.logger = logger | |
config.logger.level = :info if RAILS_ENV=='production' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Rails you can simply write 42.megabytes ;-)