It will overwrite your file.  Perhaps "a" rather than "w" would append.

I also don't think it's a tunable filesystem issue...

--Michael

On Jan 31, 2012, at 4:58 PM, Paul wrote:

> Hi all,
> 
> Since moving to Rails 3.2.1, I haven't been able to figure out how to
> flush the log file in production. I found this release note
> (https://gist.github.com/1472145), which I don't understand:
> 
> -------------------------
> ActiveSupport::BufferedLogger#auto_flushing is deprecated. Either set
> the sync level on the underlying file handle like this:
> 
> f = File.open('foo.log', 'w')
> f.sync = true
> ActiveSupport::BufferedLogger.new f
> 
> Or tune your filesystem. The FS cache is now what controls flushing.
> -------------------------
> 
> First, it seems to me that the above code would erase my existing
> production.log file. I definitely don't want that.
> 
> Second, where and when would I run this? Is this something that would
> be put in an initializer some place?
> 
> And, perhaps I don't understand the underlying system, but shouldn't I
> be setting config.logger to the return value of that, so the third
> line would be:
> 
> config.logger = ActiveSupport::BufferedLogger.new f
> 
> -------------------------
> What I'm really trying to do is have a way to get the production log
> to show the latest information. At the moment, it takes a long time to
> write. In development mode it works just fine.
> 
> (I'm on CentOS 5.5, Ruby 1.9.3, Rails 3.2.1)
> 
> Thanks!
> Paul
> 
> -- 
> 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@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to