Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Autotruncate Rails test and development log files
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib Fix for ruby 1.8.7
spec
.document Initial commit to rails_log_autotruncator.
.gitignore truncate a log file to 1000 lines if the file size > 1Mb.
.rspec Initial commit to rails_log_autotruncator.
LICENSE refresh
NOTICE
README.md
Rakefile Remove unnecessary dependencies.
VERSION Version bump to 0.2.2
init.rb truncate a log file to 1000 lines if the file size > 1Mb.
rails_log_autotruncator.gemspec

README.md

rails_log_autotruncator — Rails log auto truncate

rails_log_autotruncator is a simple (monkey)patch for ActiveSupport::BufferedLogger that limits a log file size. Use it if you just don't want your rails project development or test log file becomes large.

Disclaimer

You don't need this gem for ruby 1.9.3 and up. You can add the following code to your environment config file (i.e. config/environments/test.rb) for Rails 4.*:

config.logger = Logger.new(config.paths['log'].first, 1, 5.megabytes)

For Rails 3.*:

config.logger = Logger.new(config.paths.log.first, 1, 5.megabytes)

5.megabytes is a max log file size in this case. You can adjust it according to your needs.

Compatibility

  • Ruby 1.9.2 Rails 3.0.6
  • Ruby 1.8.7 Rails 2.3.5

Installation

Bundler

Add the rails_log_autotruncator gem to your Gemfile:

group :development, :test do
  gem 'rails_log_autotruncator'
end
Rails 2 without Bundler
gem install rails_log_autotruncator

then add to your environment.rb to Rails::Initializer.run:

config.gem "rails_log_autotruncator", :lib => "rails_log_autotruncator"

Copyright

Copyright (c) 2011 Dzmitry Plashchynski. See LICENSE for details.

Something went wrong with that request. Please try again.