rails/rails — Issue #4277: Empty log file in production using rails 3.2.0.rc1
Author: ebeigarts
Created: 2012-01-03 13:58:50+00:00
State: open

In production `log/production.log` is empty and I have found out that [04ef93d](https://github.com/rails/rails/commit/04ef93dae6d9cec616973c1110a33894ad4ba6ed#L5R33) forces `f.sync` to be false in production which somehow leaves production.log empty.

I am currently using this workaround to get logger working in production:

```ruby
App::Application.configure do
path = config.paths["log"].first
unless File.exist? File.dirname path
FileUtils.mkdir_p File.dirname path
end
f = File.open path, 'w'
f.binmode
f.sync = true

config.logger = ActiveSupport::TaggedLogging.new(
ActiveSupport::BufferedLogger.new(f)
)
config.logger.level = ActiveSupport::BufferedLogger.const_get(config.log_level.to_s.upcase)
end
```