Hi there I wanted to upload a Rails app and saw that the log files are 16mb big! Can I simply delete them? Will Rails create automatically new ones when needed? Or do I have to empty them so they aren''t that big anymore...? Thanks for info. Josh -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
you can delete them. On Sep 15, 2006, at 10:18 AM, Joshua Muheim wrote:> > Hi there > > I wanted to upload a Rails app and saw that the log files are 16mb > big! > Can I simply delete them? Will Rails create automatically new ones > when > needed? Or do I have to empty them so they aren''t that big anymore...? > > Thanks for info. > Josh > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Joshua Muheim wrote:> Hi there > > I wanted to upload a Rails app and saw that the log files are 16mb big! > Can I simply delete them? Will Rails create automatically new ones when > needed? Or do I have to empty them so they aren''t that big anymore...? > > Thanks for info. > JoshYou can include this in your environment.rb file: <code>RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 20, 10.megabyte) </code> Put it beneath the line: require File.join(File.dirname(__FILE__), ''boot'') This line will make rails automatically rotate your logs. In this instance, it will rotate the log whenever it hits 10 megabytes, and it will keep the most recent 20 files. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Or, if you really don''t need them, you can use: rake clear_logs -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
"Jon Collier" wrote:> > Joshua Muheim wrote: > > Hi there > > > > I wanted to upload a Rails app and saw that the log files are 16mb big! > > Can I simply delete them? Will Rails create automatically new ones when > > needed? Or do I have to empty them so they aren''t that big anymore...? > > > > Thanks for info. > > Josh > > > You can include this in your environment.rb file: > <code>RAILS_DEFAULT_LOGGER = > Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 20, 10.megabyte) > </code> > > Put it beneath the line: require File.join(File.dirname(__FILE__), > ''boot'') > > This line will make rails automatically rotate your logs. In this > instance, it will rotate the log whenever it hits 10 megabytes, and it > will keep the most recent 20 files. >I just want to add that the above code works very well in development. However, in production it causes the rails app to die with error code 500. Further investigation show when rotate is triggered, rails looses complete access to the production.log file. I just found out how sensitive rails is not able to write to its log. In my case Apache logged a dispatcher.fcgi error due to sending incomplete header information (35 bytes). So why is rails so sensitive about the log file? Can or should this be changed to fail write quietly or less violent? What other ways to rotate the log file, safely? Thanks for your insight, Long --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---