Forum: Ruby on Rails log file handling

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2006-04-21 20:09
(Received via mailing list)
I don't see anything on wiki.rubyonrails.org or in rubyforge that
handles logs but I am looking to perhaps tarball/compress each day's log
and save it/rotate it which I may be able to get done from logrotate on
the Linux system but I would have thought that there would be a ruby
way. I only see 'rake log:clear' in rake --tasks.

Anyone have suggestions?

Thanks

Craig
981b75f949c81efad3bc4b3c4ea88332?d=identicon&s=25 Scott Becker (Guest)
on 2006-04-22 00:37
(Received via mailing list)
Craig,

I've yet to try this, but it looks like a sweet one line solution:

Add this to RAILS_ROOT/config/environment.rb to keep 50 logfiles of 1MB
each.

   config.logger =
Logger.new("#{RAILS_ROOT}/log/#{ENV['RAILS_ENV']}.log", 50, 1048576)

from http://www.bigbold.com/snippets/posts/show/979

--
Scott Becker
Web Developer
Electro Interactive
http://www.ElectroInteractive.com
Blog: http://synthesis.sbecker.net
This topic is locked and can not be replied to.